Nav

Anypoint Object Store v2 REST APIs - Beta

Anypoint Object Store v2 (OSv2) provides REST APIs that let you get and store key,list values.

An object store belongs to an application. You can view the client ID and secret for applications from Anypoint Platform.

About Object Store v2 Operations

The Object Store Connector reads and writes in the key,value format; whereas OSv2 supports key,lists. If an application writes to an object store using the REST interface and reads with the object store connector from the same key, the read can only retrieve the value at element 0 of the list. Therefore, when using the REST API, only use the API for writing and reading content from the Object Store.

The following table compares the REST API operations to the Object Store connector operations:

Tasks OSv2 REST API Operations Object Store v2 Connector Operation

Define (Post)

  • Object Store:

    • TTL for the object store (when you create the object store) - By default TTL is 1,209,600 seconds (14 days). TTL values are in seconds. MAX TTL of 2,592,000 Seconds (30 days); however, this value cannot be changed in the Beta release.

    • Persistence property

    • Usage limits for each application or environment, includes options for limiting based on keys or size and how to enforce them.

  • Key and list (item) value

Get

  • Get keys

  • Get item

  • Get items

  • Get all items

  • Get regions for an organization

Put

  • Put item as String

  • Put item as Number

  • Put item as confirmable String

  • Put store

Delete

  • Remove object store

  • Delete key

  • Delete item

The Dual Store operation in the Object Store connector consists of these two operations where the key and value are stored and then the values reversed. The Dual Store operation acts the same as two OSv2 Put item as String calls to accomplish these results:

  1. objectStore.store(key, value);

  2. objectStore.store(value, key);

About the Object Store 2 APIs Workflow

Before deploying an object store application, log into Anypoint Platform > Runtime Manager and stop any running applications to reduce the number of allowed workers so that you can add a new application.

Accessing the Object Store 2 API works as follows:

To Deploy an Application

  1. Log into Anypoint Platform.

  2. Click Runtime Manager.

  3. If you have an existing application, click it and click Manage Application.

    If this is your first use, create an application in Anypoint Studio. When done developing, right-click the project name in Package Explorer and click Anypoint Platform > Deploy to Cloud.

  4. In the Runtime Manager Deploying Application menu:

    1. If the application name has a red X, change the name so that the green check mark appears after the name.

      The application name you choose becomes the name users access your application with. For example, if you name your application, mydemo, users can access your application at http://mydemo.cloudhub.io/.

    2. Ignore the Deployment Target and Application File fields - Anypoint Studio fills in this information for you.

    3. If needed, change the Mule Runtime version field from the drop-down list.

    4. If needed, change the Worker size field.

    5. Click Deploy Application.

To Access the REST API

Set up an application like Postman to access the object store. Obtain the access_token value (not visible currently in Beta release):

  1. Configure the object store access URL to:
    {{osBaseUrl}}/api/v1/organizations/:organizationId/environments/:environmentId/stores/myTestStoreId/objects

  2. Configure the application with HTTP headers and body for values to store to or read from the object store.

  3. Send the operation to the object store API.

To View the App Client ID and Secret

If you are the organization administrator for your Anypoint Platform account, you can view the client ID and client secret for an app from the Object Store menu.

The client ID and secret are required to authenticate an application for use with the Object Store v2 REST API.

  1. Log into Anypoint Platform > Runtime Manager.

  2. Click an app and click Manage Application. The app can be started or undeployed.

  3. If the app is not associated with Object Store V2, click the checkbox and apply changes. If the Use Object Store v2 checkbox is not visible, ensure that the Runtime Version is 3.8.4 or later.

  4. Click the Object Store menu in the left navigation area.

  5. Click Show Client Credentials.

  6. Click the Copy to Clipboard icon at the end of the client ID or secret value.

  7. Paste the client ID or secret value into your curl application that you use to authenticate the REST API.