Onedata API Reference

REST API references for Onezone, Oneprovider, and Onepanel.

Set file json metadata

PUT /data/{id}/metadata/json

This method allows to set json metadata for a file, directory or space.

This operation will replace the previous json metadata if any.

To lookup file Id using file path, please use this endpoint.

Example cURL requests

Set JSON metadata for file

curl -H "X-Auth-Token: $TOKEN" -X PUT \
-H "Content-type: application/json" \
-d '{ "key1": { "key2": ["val1", "val2", "val3", "val4"] } }'
https://$HOST/api/v3/oneprovider/data/$FILE_ID/metadata/json

Path parameters

Parameter Type & Description
id required
string

Id of the file.

Query parameters

Parameter Type & Description
filter_type
string

The type of filter to apply to the metadata document.

filter
string

The filter allowing to set specific metadata document key. Required if filter_type is specified.

Request body

application/json

The json metadata.

No schema provided.

Request Examples

Shell
cat metadata.json | oneprovider-rest-cli setJsonMetadata id=$FILE_ID -

Responses

application/json
204

JSON metadata updated successfully.

400

Invalid request.

PropertyType & Description
error
string

Identifier representing internal error code.

error_description
string

Detailed error message.

Example

application/json
{
  "error": "invalid_token",
  "error_description": "Provided token could not be validated."
}
403

Forbidden request.

PropertyType & Description
error
string

Identifier representing internal error code.

error_description
string

Detailed error message.

Example

application/json
{
  "error": "invalid_token",
  "error_description": "Provided token could not be validated."
}
404

File not found.

PropertyType & Description
error
string

Identifier representing internal error code.

error_description
string

Detailed error message.

Example

application/json
{
  "error": "invalid_token",
  "error_description": "Provided token could not be validated."
}
500

Internal server error.

PropertyType & Description
error
string

Identifier representing internal error code.

error_description
string

Detailed error message.

Example

application/json
{
  "error": "invalid_token",
  "error_description": "Provided token could not be validated."
}