GET/POST http://yourserver.com/services/updatebulk ?q=<query> &metadata=<JSON encoded metadata> &<Elvis metadata field name>=<value> |
What does it do?
This call updates the metadata of multiple existing assets in Elvis.
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:
update
http://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.
update
http://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 |
Document history
- 27 January 2019: Corrected 'parseMetadataModification' to 'parseMetadataModifications'.
Comment
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.
0 comments
Please sign in to leave a comment.