File Sharing APIs

File Sharing APIs allow users to share their files or folders with others. Currently, My Cloud Home supports link-based sharing mechanism. Sharing link is a convenient way to share files with anyone. The link includes the required authentication to read the file. Anyone who has the file link will get access to the shared files.
Creating a shareable link is a two-step process.

  • Create a sharable link using /v1/shares api for the selected file or folder IDs.
  • Set appropriate permission to the selected file or folder with the "authId" retrieved with /v1/shares api.

    POST /v1/shares HTTP/1.1Host: Endpoint-URLAuthorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJSUContent-Type: application/json{   "ownerId":"auth0|582641749a46021f65565df0",   "deviceId":"5e4ff150-5a74-4809-b41d-fcd03da95de7",   "fileIds":[      "file-id"   ]}
    201 Created{   "data":{      "shareId":"c388ee10-edc5-11e6-84dd-b9f0ca1b02eb",      "deviceId":"5e4ff150-5a74-4809-b41d-fcd03da95de7",      "ownerId":"auth0|582641749a46021f65565df0",      "authId":"auth-id",      "fileIds":[         "file-id"      ],      "dateCreated":1486534432700,      "lastModified":1486534432700,      "metadata":null,      "url":""   },   "error":null}

    Once the "url" and "authId" is retrieved with the above call, make a new call to My Cloud Home device to set read-only permissions for the selected file or folder.

    POST /sdk/v1/filePerms HTTP/1.1Host: Endpoint-URLAuthorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGContent-Type: application/json{   "fileID":"file-id",   "entity":{      "id":"c34666d0-edc5-11e6-84dd-b9f0ca1b02eb",      "type":"cloudShare"   },   "value":"ReadFile"}

    Once the file permissions are set, you can share the link retrieved through the first step. Opening the shared link in the browser allows the recipient to access all the shared files. The recipient is NOT REQUIRED to be a My Cloud Home user.