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.

Request JSON Object:
  • participant (string) – the id of the sharee (mandatory)

  • type (int) – the type of sharee (currently either 1 if it’s a group, or 0 if it’s a single user; mandatory)

  • canWrite (bool) – Whether the participant has write access (optional; defaults to false)

  • canShare (bool) – Whether the sharee should be allowed to re-share the folder with others (optional; defaults to false)

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 share

GET /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:

GET /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"
  "item": {
          "id": 17,
          "folderId": 201,
          "participant": "friends",
          "type": 1,
          "canWrite": false,
          "canShare": false
      }
}

Edit share

PUT /public/rest/v2/share/(int: share_id)
Synopsis:

Edit a share

New in version 3.0.0.

Request JSON Object:
  • canWrite (bool) – Whether the sharee should be allowed to edit the shared contents (mandatory)

  • canShare (bool) – Whether the sharee should be allowed to re-share the folder with others (mandatory)

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"
  "item": {
          "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:

DELETE /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",
}