Updating resources

Updating resources is based on two types of parameters:

  • A list of filters that allows you to limit the resources to be updated
  • A list of keys/values that allow you to define which resource attributes to update, with which value.

The keys/values to be updated must be grouped together in a "metaData" attribute, in the form of a JSON flow.

For example, the following request makes it possible to update the name and the description of resources for which the is is either 100, or 200 and for which the name is equal to "former name of the resource":

PUT /rest/ressource HTTP/1.1

Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJpZCI6ImYyMzE2…
Host: api.messengeo.net
Content-Type: application/x-www-form-urlencoded

id=100,200&name='former name of the resource'&metaData='{"name":"New name of the resource","description":"New description of the resource"}'

withCurl

curl
-X PUT
-H "Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbG...ccOqbVow8xOQyQ"
-d id=100,200
-d name='ancien nom de la ressource'
-d metaData='{"name":"Le nouveau nom de la ressource","description":"La nouvelle description de la ressource"}'
https://api.messengeo.net/rest/ressource

Actions that update resources return the number of contacts involved by the filter passed as input

{
 count: 10,
}