Table of Contents
Updating metadata on an asset
This article describes how to update metadata on an asset using the API.
Table of Contents
Syntax
PATCH asset URL Content-Type: application/vnd.fotoware.assetupdate+json Accept: application/vnd.fotoware.asset+json
The asset URL is the URL of the asset. It can be obtained by browsing an archive, through a search result, etc.
Requirements
Requires authentication: Yes
Required permissions: Edit Metadata on the archive containing the asset
Request body
The request must include a body that specifies which metadata fields will be updated and their new values. Example:
|
|
|
This request replaces the value of metadata field 5 with "The Beatles". Other metadata fields are not modified and retain their previous values. For an overview of metadata field numbers, see XMP field code reference.
It is possible to update multiple metadata fields in the same request:
|
|
|
This request replaces the values of the metadata fields 5 and 90 with different values.
Some metadata fields (bag fields) may contain multiple values. For such fields, multiple values can be given as a JSON array:
|
|
|
If only one value shall be added to a bag field, then the array brackets ([]) can be omitted:
|
|
|
It is also possible to delete a metadata field by specifying empty array brackets:
|
|
|
Request example using Curl
The following example is a CURL command line that sends a metadata update request to the API.
Before sending the request, create a text file called request.txt, that contains the request body. You can use one of the examples above.
In the following CURL command, replace the URL (shown in bold) with the fully qualified URL of the asset. This URL can be obtained, for example, by visiting the asset details page in the browser and copying the address line (excluding the fragment part after #). If you obtained the URL using the API, remember to add http:// and the hostname when using it in the following command line:
curl \ --header "Content-Type: application/vnd.fotoware.assetupdate+json" \ --header "Accept: application/vnd.fotoware.asset+json" \ --request PATCH http://fotoweb.acme.com/fotoweb/archives/5005-Photos/Incoming/0000.JPG.info \ -d @request.txt
Response data
If the request is successful, then the server sends the following response:
200 OK
Content-Type: application/vnd.fotoware.asset+json
{ ... }
The response body (omitted here) is a complete JSON representation of the asset containing the updated metadata, the remaining metadata fields, and other information.
Remarks
The API can be used to set the metadata fields defined in the metadata set of the archive containing the asset.