REST - Document - Lock
REST-Interface
Document locks are used to prevent simultaneous updating of documents by different users. Before a document can be updated, a document lock has to be acquired using a self-generated unique lock id (possibly a GUID). The unique lock id must be used in subsequent requests to update the document, keep the document locked or to unlock it. If the user logs off, all document locks are automatically released.
Acquire or update document-lock
If a client wants to edit a document, it should first acquire a lock with a “unique lock id”.
URL
PUT <application-url>/api/document/lock/<documentId>
Path parameter
- documentId
Query parameter
-
uniqueLockId
An unique lock id - possibly a GUID.
Produces
application/json
application/xml
com.matterial.mtr.api.object.DocumentLock
- 201 CREATED
- 400 BAD_REQUEST
- 500 INTERNAL_SERVER_ERROR
Permission
Login
Sample
PUT http://localhost:8080/mtr-backend/api/document/lock/8?uniqueLockId=123
Release my document-lock
Release document lock by “unique lock id”. This is the recommended way to unlock documents.
URL
DELETE <application-url>/api/document/lock
Query parameter
-
uniqueLockId
The client should have created a “unique lock id” while acquiring the lock the first time.
Produces
text/plain
Integer - count of released locks
- 200 OK
- 400 BAD_REQUEST
- 404 NOT_FOUND
- 500 INTERNAL_SERVER_ERROR
Permission
Login
Sample
DELETE http://localhost:8080/mtr-backend/api/document/lock?uniqueLockId=123
Release all document-locks by document id
If for some reason you do not know your uniqueLockId
anymore this is the only possibility to unlock the document.
URL
DELETE <application-url>/api/document/lock/<documentId>
Path parameter
- documentId
Produces
text/plain
Integer - count of released
- 200 OK
- 400 BAD_REQUEST
- 404 NOT_FOUND
- 500 INTERNAL_SERVER_ERROR
Permission
Login
Sample
DELETE http://localhost:8080/mtr-backend/api/document/lock/8