Onedata API Reference

REST API references for Onezone, Oneprovider, and Onepanel.

List directory files and subdirectories

GET /data/{id}/children

Returns the list of directory files and subdirectories.

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

Example cURL requests

Get files in space subdirectory

curl -X GET -H "X-Auth-Token: $TOKEN" \
"https://$HOST/api/v3/oneprovider/data/$DIR_ID/children"

{
  "children": [
    {
      "id": "00000000005CF4706775696423745F772D67686431633765446F4D76546D6F2D67575F3361737A7670486B477A7936587734507265584A7723394A4F355F5F396E4C31623031594576776E667431723230677767776C6B497031394E445F6E3868677873",
      "name": "File1.txt"
    },
    {
      "id": "00000000006CB6637368617265477569642333396432363661656463656266666164353939663761373734313235363166342336656331613534313362366634653262303161356338356138666437393765322331663462373632623133383039343665",
      "name": "Dir2"
    }
  ]
}

Path parameters

Parameter Type & Description
id required
string

Id of the directory.

Query parameters

Parameter Type & Description
limit
integer

Allows to specify maximum number of files that should be returned. If there are more files, they can be retrieved using index and offset query parameters.

offset
integer

Index of the partial result, can be used to get subset of the result, when the number of files and directories under given path exceeds 1000.

Request Examples

Shell
oneprovider-rest-cli listChildren id=$FILE_ID limit=100 offset=300

Responses

application/json
200

The list of directory files and subdirectories.

PropertyType & Description
children
array of objects

The list of directory files and subdirectories.

id
string

Id of the file or subdirectory.

name
string

Name of the file or subdirectory.

Example

application/json
{
  "children": [
    {
      "id": "YzQ3OThlYjItZGJkMi00ODZmLWFlOTQtMGU2ZmEwYTUwNzFk",
      "name": "File1.txt"
    },
    {
      "id": "NjIwZTE2NDItNGYyZC00NWYyLWI0ZWItMzdmOGE5NThiNDZm",
      "name": "Dir2"
    }
  ]
}
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

Invalid path - file or directory 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."
}