Reference > REST Resources in this API > Locks |
A lock is a resource that enables only the user who created the lock to edit or delete the resource indicated by the lock's data.
The locked object is indicated by the id and type fields of the lock. The user field indicates who can edit or delete the locked resource.
If there is no chance that another user might edit or delete a resource, you do not need to create a lock.
If other users might attempt to edit the resource, handle locking explicitly in your code:
DELETE any lock you POST, even if you do not update the resource.
/qcbin/api/domains/default/projects/REST/locks
/qcbin/api/domains/default/projects/REST/locks/{ID}
Lock a Defect |
Copy Code
|
---|---|
**** Request **** POST http://my_server/qcbin/api/domains/DEFAULT/projects/REST/locks HTTP/1.1 Host: my_server:8081 Connection: keep-alive Content-Length: 143 Accept: application/json Content-Type: application/json Accept-Encoding: gzip, deflate Accept-Language: en-US,en;q=0.8,he;q=0.6 Cookie: JSESSIONID=1234567890; XSRF-TOKEN=1234567890; QCSession=1234567890; ALM_USER=1234567890; LWSSO_COOKIE_KEY=1234567890 { "data": [ { "entity": { "id": 2, "type": "defect" } } ] } **** Response **** HTTP/1.1 201 Created Date: Tue, 06 Jan 2015 13:13:11 GMT Set-Cookie: LWSSO_COOKIE_KEY=1234567890; Path=/;HTTPOnly Content-Type: application/json Content-Length: 163 Server: Jetty(9.1.3.v20140225) { "data": [ { "type": "lock", "id": 1016, "entity": { "id": 2, "type": "defect" }, "user": "steves", "lock-time": "2015-01-06 15:13:11", "session-last-touch": "2015-01-06 15:13:11" } ] } |