This endpoint allows for manipulation of mutex locks on resources that should be modified by only one Bridge user at a time (currently only implemented for CourseTemplate objects).
Locks API
Interfaces
Object Synopses
Lockable
-
id
String
A UUID to uniquely identify this exact lock object
-
lockable_type
String
Entity type of the object being locked (currently only CourseTemplate)
-
lockable_id
String
Database ID of the resource referred to by this lock
-
holder_id
String
Reference to Bridge user_id who created/holds this lock
-
expires_in
Integer
Time (in seconds) until this lock will automatically expire
-
updated_at
DateTime
DateTime at which the object being locked was last updated on the server
Get lock status of a lockable resource
GET
/api/author/course_templates/:id/lock
GET
/api/author/tasks/:id/lock
Response Codes
200 OK
403 Forbidden
404 Not Found
Parameters
-
id
Integer
Required
Query parameter. This is the id of the course template resource
you are trying to view the lock status of.
Example Response
{
"lock": {
"lockable_id": 10,
"lockable_type": "CourseTemplate",
"holder_id": "1",
"expires_in": 900
}
}
Create a new lock on a resource
POST
/api/author/course_templates/:id/lock
POST
/api/author/tasks/:id/lock
Response Codes
200 OK
403 Forbidden
409 Conflict
422 Unprocessable Entity
Parameters
-
id
Integer
Required
Query parameter. This is the id of the course template resource
you are creating a lock for.
Example Response
{
"lock": {
"id": "bf45ef52-b1a7-46a1-b96d-27a9c8dd43ef",
"lockable_id": 10,
"lockable_type": "CourseTemplate",
"holder_id": "1",
"updated_at": "2016-06-17T12:41:82.000-06:00"
}
}
Renew a new lock on a resource (resets the expires_at time)
PUT
/api/author/course_templates/:id/lock
PUT
/api/author/tasks/:id/lock
Note: The UUID (unique ID of the existing lock) must be provided as an HTTP header
X-Lock-Id:
Response Codes
204 No Content
403 Forbidden
409 Conflict
422 Unprocessable Entity
Parameters
-
id
Integer
Required
Query parameter. This is the id of the course template resource
you are renewing the lock for.
Release a lock on a resource
DELETE
/api/author/course_templates/:id/lock
DELETE
/api/author/tasks/:id/lock
Note: The UUID (unique ID of the existing lock) must be provided as an HTTP header
X-Lock-Id:
Response Codes
204 No Content
403 Forbidden
409 Conflict
422 Unprocessable Entity
Parameters
-
id
Integer
Required
Query parameter. This is the id of the course template resource
you are releasing the lock for.
Interfaces
Object Synopses
Lockable
-
id
StringA UUID to uniquely identify this exact lock object
-
lockable_type
StringEntity type of the object being locked (currently only CourseTemplate)
-
lockable_id
StringDatabase ID of the resource referred to by this lock
-
holder_id
StringReference to Bridge user_id who created/holds this lock
-
expires_in
IntegerTime (in seconds) until this lock will automatically expire
-
updated_at
DateTimeDateTime at which the object being locked was last updated on the server
Get lock status of a lockable resource
Response Codes
200 OK
403 Forbidden
404 Not Found
Parameters
-
id
Integer RequiredQuery parameter. This is the id of the course template resource you are trying to view the lock status of.
Example Response
{ "lock": { "lockable_id": 10, "lockable_type": "CourseTemplate", "holder_id": "1", "expires_in": 900 } }
Create a new lock on a resource
Response Codes
200 OK
403 Forbidden
409 Conflict
422 Unprocessable Entity
Parameters
-
id
Integer RequiredQuery parameter. This is the id of the course template resource you are creating a lock for.
Example Response
{ "lock": { "id": "bf45ef52-b1a7-46a1-b96d-27a9c8dd43ef", "lockable_id": 10, "lockable_type": "CourseTemplate", "holder_id": "1", "updated_at": "2016-06-17T12:41:82.000-06:00" } }
Renew a new lock on a resource (resets the expires_at time)
Note: The UUID (unique ID of the existing lock) must be provided as an HTTP header
X-Lock-Id:
Response Codes
204 No Content
403 Forbidden
409 Conflict
422 Unprocessable Entity
Parameters
-
id
Integer RequiredQuery parameter. This is the id of the course template resource you are renewing the lock for.
Release a lock on a resource
Note: The UUID (unique ID of the existing lock) must be provided as an HTTP header
X-Lock-Id:
Response Codes
204 No Content
403 Forbidden
409 Conflict
422 Unprocessable Entity
Parameters
-
id
Integer RequiredQuery parameter. This is the id of the course template resource you are releasing the lock for.