Onedata API Reference

REST API references for Onezone, Oneprovider, and Onepanel.

Create share

POST /shares

Shares a file or a directory. Shared files can be viewed by everyone through public URL. This operation assigns a share Id that can be used to manage share, see:

Any number of shares can be associated with each file or directory.

Example cURL requests

Create share

curl -H "X-Auth-Token: $TOKEN" -X POST "https://$HOST/api/v3/oneprovider/shares" \
-H "Content-Type: application/json" -d '{"name": "MyShare", "fileId": $FILE_ID}'

Request body

application/json

Share properties.

Property
Type & Description
name
string

The name of the share.

description
string

Description of the share contents, interpreted as markdown format when displayed in GUI.

fileId
string

Id of file or directory to be shared. The whole space can also be shared.

Request Examples

application/json
{
  "name": "MyShare",
  "description": "# Top level header\nDescription of the share contents.",
  "fileId": "00000000005CF4706775696423745F772D67686431633765446F4D76546D6F2D67575F3361737A7670486B477A7936587734507265584A7723394A4F355F5F396E4C31623031594576776E667431723230677767776C6B497031394E445F6E3868677873"
}

Responses

application/json
201

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

Property
Type & Description
shareId
string

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