Locking

As a client application of this API will likely make many requests in succession to synchronize its state with the app, a simple per-user locking mechanism was implemented to let clients know when a different client is currently making changes.

Acquire lock

POST /public/rest/v2/lock
Synopsis:

Acquire a lock for the authenticated user. This lock will be automatically released after a timeout of 30min. If the client requesting the lock needs longer than 30min it has to repeat the request.

Added in version 10.0.0.

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

Example:

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

Response:

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

{
  "status": "success",
}

Example:

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

Response:

HTTP/1.1 423 Locked
Content-Type: application/json

{
  "status": "error", "data": "Resource is already locked"
}

Release lock

DELETE /public/rest/v2/lock
Synopsis:

Release the lock for the authenticated user

Added in version 10.0.0.

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

Example:

DELETE /index.php/apps/bookmarks/public/rest/v2/lock HTTP/1.1
Host: example.com
Accept: application/json

Response:

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

{
  "status": "success",
}