Onedata API Reference

REST API references for Onezone, Oneprovider, and Onepanel.

Get file attributes

GET /data/{id}

This method returns either all or only selected basic attributes associated with file specified by $FILE_ID.

Example cURL requests

Get file size

curl -X GET -H "X-Auth-Token: $TOKEN" \
"https://$HOST/api/v3/oneprovider/data/$FILE_ID?attribute=size"

{
  "size": 100
}

Path parameters

Parameter Type & Description
id required
string

File, directory or space Id

Query parameters

Parameter Type & Description
attribute
string

Name of attribute to query for. When accessing file via share mode following attributes are unavailable: owner_id, storage_group_id, storage_user_id, provider_id

Request Examples

Shell
oneprovider-rest-cli getAttrs id=$FILE_ID

Responses

application/json
200

Returns the requested file attributes.

PropertyType & Description
name
string

File name.

type
string

Type of the file.

Enum:
regdirlnk
mode
integer

POSIX file permissions in decimal format

size
integer

Size of the file in bytes.

atime
integer

Last access timestamp (in seconds).

mtime
integer

Last modification timestamp (in seconds).

ctime
integer

Last attributes modification timestamp (in seconds).

owner_id
string

Id of the owner of this file.

file_id
string

Id of the file.

provider_id
string

Id of the provider on which this file was created.

storage_user_id
string

Id of the owner of this file on storage.

storage_group_id
string

Id of the group owner of this file on storage.

shares
array of strings

The list of Ids of shares created for this file.

Example

application/json
{
  "name": "File1.txt",
  "type": "REG",
  "mode": 511,
  "size": 1024,
  "atime": 1464958683054,
  "mtime": 1464958683051,
  "ctime": 1464958681054,
  "owner_id": "MTZjYzc1ZWEtN2ZjNC00Y2QxLTljYzgtMTJmYTMxNTk1YzUw",
  "file_id": "NjIwZTE2NDItNGYyZC00NWYyLWI0ZWItMzdmOGE5NThiNDZm",
  "provider_id": "YzQ3OThlYjItZGJkMi00ODZmLWFlOTQtMGU2ZmEwYTUwNzFk",
  "storage_user_id": 1935313,
  "storage_group_id": 1101841,
  "shares": [
    "1d24c36707d99197c6cd995810a43aca",
    "6825604b0eb6a47b8b7a04b6369eb24d"
  ]
}
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."
}