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 userpath
(optional): the path of the data you want to managemode
: 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 dataPUT
orPOST
: To update or create dataDELETE
: To remove one key of the data
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.
Related topics
- Account configuration: How to configure the account
P_change_metadata
: The method to change one specific metadataP_change_preferences
: The method to change one specific preferencesave_user_metadata
: The method to change all user's metadatasave_preferences
: The method to change all user's preferences
Please give details of the problem