Onedata API Reference

REST API references for Onezone, Oneprovider, and Onepanel.

Get shared file or directory data

GET /shares/data/{file_id}/{subpath}

This endpoint can be used to fetch publicly available information and content of a shared file or directory knowing its Id, without any authentication. It redirects to the corresponding REST endpoint in one of the supporting Oneproviders. The Oneprovider is chosen dynamically and may change in time, so the redirection URL should not be cached.

The endpoint accepts only identifiers of shared files/directories and will reject requests if a containing share is deleted. The shared file/directory Id can be acquired either by fetching public share details or by listing a shared directory.

The provided query string (if any) is preserved during redirection - consult corresponding Oneprovider REST endpoints for possible options.

Currently, publicly available operations are:

  • {...}/$FILE_ID/content - download file or directory content (see Oneprovider REST endpoint)

  • {...}/$FILE_ID/children - list directory files and subdirectories (see Oneprovider REST endpoint)

  • {...}/$FILE_ID - get basic attributes of a file or directory (see Oneprovider REST endpoint)

  • {...}/$FILE_ID/metadata/xattrs - get custom extended attributes (xattrs) associated with a file or directory (see Oneprovider REST endpoint)

  • {...}/$FILE_ID/metadata/json - get custom JSON metadata associated with a file or directory (see Oneprovider REST endpoint)

  • {...}/$FILE_ID/metadata/rdf - get custom RDF metadata associated with a file or directory (see Oneprovider REST endpoint)

The endpoint will return 503 Service Unavailable when there is no suitable Oneprovider to handle the request and 501 Not Implemented when all available Oneproviders are in versions older than 20.02.*. If an invalid subpath is requested, the target Oneprovider will respond with a proper error.

Example cURL requests

Get shared file or directory data

curl -v -X GET https://$ZONE_HOST/api/v3/onezone/shares/data/$FILE_ID/content

< HTTP/1.1 307 Temporary Redirect
< location: https://provider.example.com/api/v3/oneprovider/data/$FILE_ID/content

# -------------------------------------------------------------------------------

curl -v -X GET https://$ZONE_HOST/api/v3/onezone/shares/data/$FILE_ID/children?limit=3

< HTTP/1.1 307 Temporary Redirect
< location: https://provider.example.com/api/v3/oneprovider/data/$FILE_ID/children?limit=3

# -------------------------------------------------------------------------------

# automatically follow redirects with -L option, request a byte range
curl -L -X GET https://$ZONE_HOST/api/v3/onezone/shares/data/$FILE_ID/content \
-H "Range: bytes=5-8"

fghi

Path parameters

Parameter Type & Description
file_id required
string

Shared file/directory Id.

subpath required
string

Subpath corresponding to desired Oneprovider REST API operation.

Request Examples

Shell
onezone-rest-cli getSharedData file_id=000000000055D4E4836803640004677569646D00 subpath='content'

Responses

application/json
307

Redirection to one of the supporting providers in the response Location header.

400

Invalid request.

PropertyType & Description
error
object

Object describing an error.

id required
string

String identifying the error type. Does not change between error instances.

description required
string

Human readable error description. May contain information specific to given error instance.

details
object

Details about the error instance. The object schema is specific to each error type.

Example

application/json
{
  "error": {
    "id": "badValueString",
    "details": {
      "key": "name"
    },
    "description": "Bad value: provided \"name\" must be a string."
  }
}
401

Authentication error.

PropertyType & Description
error
object

Object describing an error.

id required
string

String identifying the error type. Does not change between error instances.

description required
string

Human readable error description. May contain information specific to given error instance.

details
object

Details about the error instance. The object schema is specific to each error type.

Example

application/json
{
  "error": {
    "id": "badValueString",
    "details": {
      "key": "name"
    },
    "description": "Bad value: provided \"name\" must be a string."
  }
}
403

Authorization error.

PropertyType & Description
error
object

Object describing an error.

id required
string

String identifying the error type. Does not change between error instances.

description required
string

Human readable error description. May contain information specific to given error instance.

details
object

Details about the error instance. The object schema is specific to each error type.

Example

application/json
{
  "error": {
    "id": "badValueString",
    "details": {
      "key": "name"
    },
    "description": "Bad value: provided \"name\" must be a string."
  }
}
404

Resource not found.

PropertyType & Description
error
object

Object describing an error.

id required
string

String identifying the error type. Does not change between error instances.

description required
string

Human readable error description. May contain information specific to given error instance.

details
object

Details about the error instance. The object schema is specific to each error type.

Example

application/json
{
  "error": {
    "id": "badValueString",
    "details": {
      "key": "name"
    },
    "description": "Bad value: provided \"name\" must be a string."
  }
}
500

Internal server Error.

PropertyType & Description
error
object

Object describing an error.

id required
string

String identifying the error type. Does not change between error instances.

description required
string

Human readable error description. May contain information specific to given error instance.

details
object

Details about the error instance. The object schema is specific to each error type.

Example

application/json
{
  "error": {
    "id": "badValueString",
    "details": {
      "key": "name"
    },
    "description": "Bad value: provided \"name\" must be a string."
  }
}
501

Not Implemented - all available providers are in versions older than 20.02.*.

PropertyType & Description
error
object

Object describing an error.

id required
string

String identifying the error type. Does not change between error instances.

description required
string

Human readable error description. May contain information specific to given error instance.

details
object

Details about the error instance. The object schema is specific to each error type.

Example

application/json
{
  "error": {
    "id": "badValueString",
    "details": {
      "key": "name"
    },
    "description": "Bad value: provided \"name\" must be a string."
  }
}
503

Service Unavailable - there is no suitable provider to handle the request.

PropertyType & Description
error
object

Object describing an error.

id required
string

String identifying the error type. Does not change between error instances.

description required
string

Human readable error description. May contain information specific to given error instance.

details
object

Details about the error instance. The object schema is specific to each error type.

Example

application/json
{
  "error": {
    "id": "badValueString",
    "details": {
      "key": "name"
    },
    "description": "Bad value: provided \"name\" must be a string."
  }
}