Creates a new share

Contents

Creates a new share for the calling user.

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

Request Syntax


POST /v1/shares



Request Headers

Parameter Description Required
Authorization Authorization token in the form "Bearer {token}"

Value of type: string
true


Request Body

Parameter Description Required
deviceId The ID of device.

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

Array of type: string
true
metadata Value of type: object false
ownerId The 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
useCache A boolean value of user's preference on using cache for the created share.

Value of type: boolean
false
userIds An 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

Parameter Description Required
Access-Control-Allow-Origin Indicates whether the response can be shared with resources with the given origin.

Value of type: string
false


Response Payload

Parameter Description Required
data Object of type: PostShareResponse false
error Null 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
message Description, 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.1
Host: Endpoint-URL
Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSU
Content-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
}

Have question about this section?