Modify a file's metadata

/files/{file_id}/metadata

For general information on the API, including formatting, parameters, and pagination, please see the API Overview.

This call modifies the metadata values for the specified file.

🚧

Metadata on the Platform

Learn more about metadata fields and their values on CAVATICA.

Files are specified by their IDs, which you can obtain by making the API call to list files in a project .

https://cavatica-api.sbgenomics.com/v2/files/{file_id}/metadata

👍

PUT and PATCH

The API has two method to modify file metadata. This method uses the HTTP verb PATCH, and the other uses the HTTP verb PUT.

The difference between the two concerns the way that they update the information stored about the user. PATCH allows you to update just one metadata field. On the other hand, a PUT request will fully overwrite the values for all metadata fields. This means that when issuing a PUT request you must enter values for every key required to specify the metadata, even if the values for some keys are unchanged. If you don't specify a value for a given metadata field when making the PUT request, then any existing value for that field will be reset.

Request

Example request

PATCH /v2/files/567890abc9b0307bc0414164/metadata HTTP/1.1
Host: cavatica-api.sbgenomics.com
X-SBG-Auth-Token: 1e43fEXampLEa5523dfd14exAMPle3e5
curl --data '{"foo": "bar"}'  -s -H "X-SBG-Auth-Token: 7942f56901534434a054dafc3813bc96" -H "content-type: application/json" -X PATCH "https://cavatica-api.sbgenomics.com/v2/files/567890abc9b0307bc0414164/metadata"

Header Fields

NameDescription
X-SBG-Auth-Token
required
Your CAVATICA authentication token.

Path parameters

NameDescription
file_idThe ID of the file whose metadata you want to update.

Query parameters

NameData typeDescription
fieldsstringSelector specifying a subset of fields to include in the response.

Request body

Enter a dictionary of key-value pairs to the request body.

KeyDatatype of valueDescription of value
Freeform -- enter any key.stringThe value for the corresponding key

Example request body

{
  "foo": "bar"
}

Response

See a list of CAVATICA-specific response codes that may be contained in the body of the response.

Example response body

The response contains the full metadata specification for the file, including the values that you just added with the request.

{
  "library_id": "12345",
  "platform": "my_platform",
  "foo": "bar",
  "my_key_1": "my_value_1",
  "my_key_2": "my_value_2"
}

Language