August 8, 2022

Blog @ Munaf Sheikh

Latest news from tech-feeds around the world.

Update Object Store Values Using Object Store V2

Great post from our friends at Source link

Object Store in MuleSoft is used to store key-value pairs that we might need to preserve for future use. In this tutorial, we will learn how we can use Object Store V2 REST APIs to dynamically update the values present in our object store without making any changes to our code.

For a detailed explanation on Object Store and rest APIs please refer to official MuleSoft documentation.


  1. An App that uses Object Store v2 and is deployed to CloudHub
  2. Access Token for the Anypoint Platform User

Access Object Store v2 API:

In order to access the REST APIs, we would need the following details:

  1. Organization ID
  2. Environment ID
  3. Base URL
  4. Access Token

Steps for Organization ID:

  1. Login to the Anypoint Platform.
  2. Click on Access Management:
  3. Inside Access Management, choose the organization tab and click on your desired business group.
  4. Add Business GroupCopy and save the Organization Id.

Organization ID

Steps for the Environment ID:

  1. Login to the Anypoint Platform.
  2. Click on API Manager.
  3. API ManagerMake sure you are in your desired Environment and then click on the “i” button to get Environment Information.
  4. Environment InformationCopy and save the Environment Id.

Environment ID

NOTE: Based on the region your app is deployed in you can get the Base URL from below:

Control Plane BASE_URL Region


US East (N. Virginia)

US East (Ohio)

US West (N. California)

US West (Oregon)

Asia Pacific (Singapore)

Asia Pacific (Sydney)

Asia Pacific (Tokyo)

Canada (Central)

Europe (Frankfurt)

Europe (London)

Europe (Ireland)

South America (São Paulo)

Steps for the Access Token:

  1. Make a POST call to the below URL, by passing the username and password for your Anypoint platform user.  

NOTE: The user must have Admin Access in order to retrieve the token.

Access Token2.  Copy and save the access token.

Retrieve the List of Object Stores

In order to retrieve the list of object stores in a particular Environment, make a GET call to the below URL using Postman:


Change the values of BASE_URL, ORG_ID, and ENV_ID to the one retrieved earlier.

NOTE: Do pass the Access Token in headers as Type Bearer.

Store ID

On a similar line, you can use the below URL to get the list of partitions:


Update Value for a Particular Key In Object Store

In order to update the value for a particular key, make a PUT call to the below URL and pass the body in the below format:


Change the values of BASE_URL, ORG_ID, ENV_ID, STORE_ID, and PARTITION_ID to the one retrieved earlier. Also, pass the KEY_ID (i.e. name of the key that you want to update).



    "keyId" : "currentDate",

    "valueType" : "STRING",

    "stringValue" : "2021-12-30"



This is how we can update the value of a key in Object Store v2 using REST APIs.

#Update #Object #Store #Values #Object #Store