Shares

Share model

Share
Param int id:The share’s unique id
Param int folderId:
 The id of the folder that was shared
Param string participant:
 The id of the participant that the folder was shared to
Param int type:The participant type. Currently either 0 for users, or 1 for groups.
Param boolean canWrite:
 Whether the participant has write access.
Param boolean canShare:
 Whether the participant is allowed to reshare the folder or subfolders to other users, including the creation of public links.

Create a share

POST /public/rest/v2/folder/(int: folder_id)/shares
Synopsis:Create a share for a folder

New in version 3.0.0.

Response JSON Object:
 
  • status (string) – success or error
  • item (share) – The new share

Example:

POST /index.php/apps/bookmarks/public/rest/v2/folder/5/shares HTTP/1.1
Host: example.com
Accept: application/json

Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "status": "success"
  "item": {
      "id": 5,
      "folderId": 201,
      "participant": "friends",
      "type": 1,
      "canWrite": false,
      "canShare": false
  }
}

Get folder’s shares

GET /public/rest/v2/folder/(int: folder_id)/shares
Synopsis:Retrieves all shares of a folder

New in version 3.0.0.

Response JSON Object:
 
  • status (string) – success or error
  • data (array) – The shares of this folder

Example:

GET /index.php/apps/bookmarks/public/rest/v2/folder/5/shares HTTP/1.1
Host: example.com
Accept: application/json

Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "status": "success"
  "data": [
      {
          "id": 5,
          "folderId": 201,
          "participant": "friends",
          "type": 1,
          "canWrite": false,
          "canShare": false
      }
  ]
}

Get public token

GET /public/rest/v2/folder/(int: folder_id)/publictoken
Synopsis:Retrieve the public token of a folder that has been shared via a public link

New in version 3.0.0.

Response JSON Object:
 
  • status (string) – success or error
  • item (share) – The public token

To use the token either make API requests with it (see User-based authentication). Or point your browser to https://yournextcloud.com/index.php/apps/bookmarks/public/{token}

Example:

GET /index.php/apps/bookmarks/public/rest/v2/folder/5/publictoken HTTP/1.1
Host: example.com
Accept: application/json

Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "status": "success",
  "item": "dk3J8Qm"
}

Get share

POST /public/rest/v2/share/(int: share_id)
Synopsis:Get a share by id

New in version 3.0.0.

Response JSON Object:
 
  • status (string) – success or error
  • item (share) – The requested share

Example:

POST /index.php/apps/bookmarks/public/rest/v2/share/17 HTTP/1.1
Host: example.com
Accept: application/json

Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "status": "success"
  "data": [
      {
          "id": 17,
          "folderId": 201,
          "participant": "friends",
          "type": 1,
          "canWrite": false,
          "canShare": false
      }
  ]
}

Edit share

PUT /public/rest/v2/share/(int: share_id)
Synopsis:Get a share by id

New in version 3.0.0.

Response JSON Object:
 
  • status (string) – success or error
  • item (share) – The requested share

Example:

PUT /index.php/apps/bookmarks/public/rest/v2/share/17 HTTP/1.1
Host: example.com
Accept: application/json

{
  "canWrite": true,
  "canShare": false
}

Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "status": "success"
  "data": [
      {
          "id": 17,
          "folderId": 201,
          "participant": "friends",
          "type": 1,
          "canWrite": true,
          "canShare": false
      }
  ]
}

Delete share

DELETE /public/rest/v2/share/(int: share_id)
Synopsis:Delete a share

New in version 3.0.0.

Response JSON Object:
 
  • status (string) – success or error

Example:

POST /index.php/apps/bookmarks/public/rest/v2/share/17 HTTP/1.1
Host: example.com
Accept: application/json

Response:

HTTP/1.1 200 OK
Content-Type: application/json

{
  "status": "success",
}