Creates a new share


Creates a new share for the calling user.

Endpoint URL: {service.share.url} received in EndpointFetching

Request Syntax

POST /v1/shares


Request Headers

ParameterDescriptionRequired
AuthorizationAuthorization token in the form "Bearer {token}"

Value of type: string
true


Request Body

ParameterDescriptionRequired
deviceIdThe ID of device.

Value of type: string
true
fileIdsAn array of fileId values of the files being shared.

Array of type: string
true
metadataValue of type: objectfalse
ownerIdThe userId of the caller creating the share passed as part of the JSON post body. This must match the user in the Authorization token.

Value of type: string
true
useCacheA boolean value of user's preference on using cache for the created share.

Value of type: boolean
false
userIdsAn array of userId values of the users being shared passed as part of the JSON post body. If no userIds are provided then a public share is created which can be accessed by anyone.

Array of type: string
false


201 Response

Success

Response Headers

ParameterDescriptionRequired
Access-Control-Allow-OriginIndicates whether the response can be shared with resources with the given origin.

Value of type: string
false


Response Payload

ParameterDescriptionRequired
dataObject of type: PostShareResponsefalse
errorNull if the operation is successful. An unsuccessful response will return a 4xx or 5xx HTTP status code.

An example of an insufficient request would be a missing parameter and you would get the following response body in addition to a 400 HTTP status code.

{ "data": null, "message": "400 Bad Request Required parameter accessToken not present or empty", "error": { "label": "GENERAL_INSUFFICIENT_PARAMETERS" } }

Possible HTTP response codes, error labels, and messages:

* 400, GENERAL_INSUFFICIENT_PARAMETERS, "400 Bad Request Required parameter _{parameter name}_ not present, invalid or empty"

* 400, GENERAL_INVALID_PARAMETER_LIST, "400 Bad Request Required parameter _{parameter name}_ is not a list, invalid, or empty"

* 400, SHARES_AUTH_OWNER_MISMATCH, "400 Bad Request The authorized user id is not the same as the owner id"

* 401, GENERAL_INVALID_TOKEN, "401 Not Authorized User token is invalid"

* 404, GENERAL_NOT_FOUND, "404 Not Found Could not find share"

* 405, GENERAL_METHOD_NOT_ALLOWED, "405 Method Not Allowed PUT not allowed for this resource"

* 500, GENERAL_UNKNOWN, "500 Internal Server Error An unexpected error occurred"

* 500, GENERAL_NOT_CREATED, "500 Internal Server Error Could not create share"

Value of type: object

false
messageDescription, e.g. Share created successfully.

Value of type: string
false


Example

Sample request to create a new share.

Request

POST shares/v1/shares HTTP/1.1Host: Endpoint-URLAuthorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUContent-Type: application/json{   "ownerId":"auth0|582641749a46021f65565df0",   "deviceId":"xyz",   "useCache": true,   "fileIds": ["123","456","789"]}

Response

HTTP/1.1 200 OK{  "data": {    "deviceId": "xyz",    "shareId": "57c81860-a841-11e5-a6be-75c59f356c18",    "authId": "7898798798797987978",    "fileIds": [      "123",      "456",      "789"    ],    "ownerId": "auth0|582641749a46021f65565df0",    "url": "https://mycloud.com/#/action/share/57c81860-a841-11e5-a6be-75c59f356c18"  },  "message": "Share created successfully",  "error": null}