What does it do?
This call updates the metadata of multiple existing assets in Elvis, either by using a query or based on ID.
POST requests only
This REST API only accepts POST requests, not GET requests. Also, the POST request needs to include a cross-site request forgery (csrf) token.
The csrf token is a unique code which, by including it in the request, also makes the POST request unique and therefore much more secure.
The csrf token is obtained by first logging in to Elvis Server through a POST request. The response that is received will include the csrf token which can then be used in subsequent POST requests as a http header:
"X-CSRF-TOKEN: <some_csrf_token>"
For more information including examples, see Elvis 6 REST API - Performing a POST request with a csrf token.
Methods

In this method, assets are targeted based on a general query.
POST http://yourserver.com/services/updatebulk ?q=<query> &metadata=<JSON encoded metadata> &<Elvis metadata field name>=<value> |
Parameters
q |
A query matching the assets that should be updated, see the query syntax guide for details. Required.
|
|
metadata |
A JSON encoded object with properties that match Elvis metadata field names. This metadata will be set on the asset in Elvis. Optional. You can also use parameters matching Elvis field names. |
|
* |
Any parameter matching an Elvis metadata field name will be used as metadata. This metadata will be set on the asset in Elvis. Optional. You also use the 'metadata' parameter. Tip: The update bulk service uses the same kind of parameters to specify metadata as the update service. |
|
async |
When true, the process will run asynchronous in the background. The call will return immediate with the processId. Optional. By default, the call waits for the process to finish and then returns the processedCount. |
|
parseMetadataModifications |
Prevents parsing "+" and "-" when set to false. Optional. Default true. |
Return value
The operation returns a JSON object with the following properties:
processedCount | Number of assets that were processed by the operation. |
errorCount | Number of errors that occurred. |
If called with async=true, the operation returns a JSON object with the following properties:
processId | Unique id of the process that was started. |
If the operation fails, a JSON error object is returned.
Examples
Update metadata
This call sets the rating to 4 and status to New for all assets with the tag "animal":
update http://demo.elvisdam.com/services/updatebulk ?q=tags:animal &metadata={rating: -1, status: "Correction"} |
Passing metadata as separate parameters is useful when working with HTML forms, but for AJAX calls it can be easier to pass metadata as a JSON encoded string. The following will set the rating to "Rejected" (-1) and will change the status to "Correction" on all assets below the "Demo Zone/Images/Nature" folder:
updatehttp://demo.elvisdam.com/services/updatebulk ?q=ancestorPaths:"/Demo Zone/Images/Nature" &rating=0 &status=New |
Add values to existing metadata
Using an updatebulk, you can append or remove existing metadata on multiple assets. For example, you could add a tag to a set of assets while leaving their current tags intact.
Tip: You need to escape the '+' character with %2B if you use it in URLs. A plain '+' would be interpreted as a space character (as defined in the specification on URL encoding).
The following call will remove the "house" tag from all assets that have it, while at the same time adding the tags "beach", "villa", "sunny". If one of the assets has the tags "sea", "bay", those would not be removed. If one of the assets has the tag "villa", it will not get "villa" twice, assets can only have a specific tag once.
updatehttp://demo.elvisdam.com/services/updatebulk ?q=tags:house &tags=%2Bbeach, -house, %2Bvilla, %2Bsunny |
It is also possible to append text to a single value field using the '+' character or add text around the existing value using {CURRENT}.
update http://demo.elvisdam.com/services/updatebulk ?q=tags:house &description=%2Bhouse &subject=before{CURRENT}after |

In this method, assets are targeted by referencing their ID.
The API endpoint is the same as for the query method, but it takes an array of objects as parameter:
[object1, object2,object3,...]
The object in the array should have an "id" of type 'string' and a metadata object. For example:
[ { "id":"8LYE_winarE8ETOFU9L2di", "metadata":{ "status":"Draft" } }, { "id":"8vUY-5NlKR_9d4URK-YfpP", "metadata":{ "status":"Production", "description":"Ready for production" } }, { "id":"Dnt5MAmPqVo9R1jZXpOpGN", "metadata":{ "description":"A nice description of my file" } } ]>
An array is returned with the updated asset objects, similar to the given parameters.
Document history
- 6 January 2021: Added the method of targeting assets by ID.
Comments
Do you have corrections or additional information about this article? Leave a comment!
Do you have a question about what is described in this article? Please contact support here.
0 comments
Please sign in to leave a comment.