×

Please give details of the problem

Skip to content

Development with Metadata and preferences

The metadata and preferences are a set of data configured for each user of the account.

Using metadata and preferences with the resources

URI

The uri are of the following format:

  • /config/{customer_id}/user/{user_id}/metadata/{path}?P_mode={mode}
  • /config/{customer_id}/user/{user_id}/preferences/{path}?P_mode={mode}

with

  • customer_id: the id of the customer (the id of the account)
  • user_id: the id of the user
  • path (optional): the path of the data you want to manage
  • mode: the execution mode where you want to see or update the data

Content-Type and Accept type

Those resources will communicate only in JSON. It's why you have to set the Content-Type and the Accept properties to application/json in the header of your HTTP request.

Methods

The resources accept the following methods:

  • GET: To get the data
  • PUT or POST: To update or create data
  • DELETE: To remove one key of the data

info_1 For each action, the rights will be checked

Samples

For our example the account (123) is configured with the following metadata:

identity <structure>
    age: <number>
    name: <string>
    items: <array of string>

The user (456) will have, for instance, the following values:

{"identity":{
    "age": 20,
    "name": "John Doe",
    "items": ["plate", "knife", "fork"]
    }
}

REQUEST: GET http://live.runmyprocess.com/config/123/user/456/metadata/identity/age
RESPONSE: {"data":20}

REQUEST: GET http://live.runmyprocess.com/config/123/user/456/metadata/identity/items
RESPONSE: {"data":["plate", "knife", "fork"]}

REQUEST: GET http://live.runmyprocess.com/config/123/user/456/metadata/identity/items/1
RESPONSE: {"data":"knife"}

REQUEST: PUT http://live.runmyprocess.com/config/123/user/456/metadata/identity/items/0
POST DATA: {"data":"cup"}
RESPONSE: {"data":{"identity":{ "age": 20, "name": "John Doe", "items": ["cup", "knife", "fork"] } }}

Freemarker methods

According to the resources, two methods allow to change metadata or preferences of user with a path.

  • P_change_metadata: Like the resource, you can specify a path to change specificly a key of the metadata.
  • P_change_preferences: Like the resource, you can specify a path to change specificly a key of the preferences.