Onedata API Reference

REST API references for Onezone, Oneprovider, and Onepanel.

Create file or directory

POST /data/{id}/children

Creates a file or directory in the directory specified by $PARENT_ID. The data sent in request body (if any) will be saved as file content.

Example cURL requests

Create file

curl -H "X-Auth-Token: $TOKEN" \
-X POST "https://$HOST/api/v3/oneprovider/data/$PARENT_ID/children?name=$FILE_NAME" \
-H "Content-Type: application/octet-stream" -d "@file.dat"

{
   "fileId": "094576776E667431723230677767776C6B497031394E445F6E3868677873..."
}

Create directory

curl -H "X-Auth-Token: $TOKEN" \
-X POST "https://$HOST/api/v3/oneprovider/data/$PARENT_ID/children?name=$DIR_NAME&type=dir" \

{
   "fileId": "000000006CB6637368617265477569642333396432363661656463656266..."
}

Path parameters

Parameter Type & Description
id required
string

Id of the parent directory.

Query parameters

Parameter Type & Description
name required
string

Name of the file.

type
string

Type of the file.

mode
integer

POSIX file permissions in decimal format.

offset
integer

Offset at which data sent as request body should be written to file.

Request body

application/octet-stream

File content to be written at specified offset.

No schema provided.

Request Examples

Shell
oneprovider-rest-cli createFile id=$PARENT_ID name=$FILE_NAME

Responses

application/json
201

The request has been accepted and the result is the file Id. Also URI of the file in form https://$HOST/api/v3/oneprovider/data/{id} is returned in the response Location header.

Property
Type & Description
fileId
string

file Id.

400

Invalid request.

Property
Type & 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.

Property
Type & 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.

Property
Type & 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.

Property
Type & 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."
}