Onedata API Reference

REST API references for Onezone, Oneprovider, and Onepanel.

Get file json metadata

GET /data/{id}/metadata/json

This method returns the json metadata associated with specified file, directory or space.

By default the method returns the complete json metadata. But it is possible to request only a part of the document by specifying filter_type and filter attributes in the query.

Supported filter types are:

  • keypath - list of JSON keys which point to requested JSON object, separated by ., array elements should be expressed as [i] (e.g. key1.key2.[2].key3)

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

Example cURL requests

Get specific JSON value from metadata document

curl -H "X-Auth-Token: $TOKEN" -X GET \
https://$HOST/api/v3/oneprovider/data/$FILE_ID/metadata/json?filter_type=keypath&filter=key1.key2.[2].key3

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 to apply to the metadata document before returning.

inherited
boolean

When set to true, this operation will merge the metadata documents from parent directories as well as entire space into a single JSON document.

Request Examples

Shell
oneprovider-rest-cli getJsonMetadata id=$FILE_ID inherited=false

Responses

application/json
200

JSON metadata returned successfully.

No schema provided.

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."
}