Skip to content

Latest commit

 

History

History
60 lines (47 loc) · 2.52 KB

locks.md

File metadata and controls

60 lines (47 loc) · 2.52 KB

Locking endpoints

Get active locks

Retrieves all active locks for the specified subject. For now, it lists all the gadget locks in the specified course.

Request property Spec
Action GET /locks
SID header
subject.courseId param courseKey. Required.
Body model no body
Scala class GetActiveLocks
Status Response body spec
200 Array of Resource lock
404 {"error": 404, "message": "Course '$courseKey' not found"}
If courseKey does not identify a course.
403 {"error": 403, "message": "Insufficient permissions"}
If the user is not authorized to update the requested resource.
401 Invalid credentials

Lock resource

Creates a new lock on the specified resource. User can have only one lock on the resource of the one type. If user requests another lock, the old one gets automatically released.

Request property Spec
Action POST /locks
SID header Must be a user SID.
Body model Lock request
Scala class AcquireResourceLock
Status Response body spec
201 Resource lock
404 {"error": 404, "message": "Course '$courseKey' not found"}
If courseKey does not identify a course.
404 {"error": 404, "message": "Gadget '$gadgetId' not found"}
If lessonId does not identify a gadget in the course.
403 {"error": 403, "message": "Resource locked"}
If the requested lock subject is already locked by another user.
403 {"error": 403, "message": "Insufficient permissions"}
If the user is not authorized to update the requested resource.
401 Invalid credentials, if SID is not for a user.
400 Bad request

Unlock resource

Deletes specified lock.

Request property Spec
Action DELETE /locks/lockId
Body model no body
Scala class ReleaseResourceLock
Status Response body spec
200 {} If lock was successfully released
403 {"error": 403, "message": "Insufficient permissions"}
If the lock was created by another user.
404 {"error": 404, "message": "Lock '$lockId' not found"}
If the lock does not exist