Skip to content

Latest commit

History

History
86 lines (53 loc) 路 1.77 KB

locking.rst

File metadata and controls

86 lines (53 loc) 路 1.77 KB

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

/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.

10.0.0

>json string status

success or error

Example:

http

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

Response:

http

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

{

"status": "success",

}

Example:

http

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

Response:

http

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

{

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

}

Release lock

/public/rest/v2/lock

synopsis

Release the lock for the authenticated user

10.0.0

>json string status

success or error

Example:

http

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

Response:

http

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

{

"status": "success",

}