Object Locks

Lock Object

POST /api/.../objectlocks

Lock a specific object. If the object is already locked by another user, the request will return a 409 (conflict) error with the object lock data indicating which user already has the object locked. If the object is successfully locked by this call, a 200 status is returned with the object lock information in the body of the response. If the lock exists for the same user, the request returns 200 with 'ExistingLock' in object lock data to be true.

Request Information

Parameters
Name Type Required Description
objecttypeid Integer Yes The id of the type of object.
objectid Integer Yes The id of the object.

These should be placed in the body of the request. If using JSON as the format, include a header value for Content-Type of "application/json".

Example request body:

{
    "ObjectTypeID" : 27,
    "ObjectID" : 29937
}

Response Information

Example - 200
application/json, text/json
{
    "ExistingLock: true",
    "ObjectTypeID" : 1,
    "ObjectID" : 10,
    "PolarisUserID" : 101,
    "WorkstationID" : 1,
    "LockDate" : "2013-04-03T09:06:33.367",
    "LockExistsInDatabase": true
}
Example - 409
application/json, text/json
{
    "ErrorCode": 70000,
    "Message": "Exception of type 'Polaris.Common.Exceptions.PolarisObjectLockException' was thrown.",
    "MessageDetail": null,
    "StackTrace": null,
    "InnerException": null,
    "Data": {
        "ObjectTypeID": 3,
        "ObjectID": 2655,
        "PolarisUserID": 1,
        "WorkstationID": 15,
        "LockDate": "2015-09-14T16:59:18-04:00",
        "PolarisUserName": "PolarisExec",
        "WorkstationName": "Peng Zhang"
    }
}

HTTP Response Codes

Code Description
200 OK. Object successfully locked.
409 FAIL. Object is already locked by another user.

Lock multiple objects of same object type

POST /api/.../objectlocks/{objecttypeid}

Lock multiple objects of same object type. If the object is already locked by another user, the request will return a 409 (conflict) error with the object lock data indicating which user already has the object locked. If the object is successfully locked by this call, a 200 status is returned with the object lock information in the body of the response. If the lock exists for the same user, the request returns 200 with 'ExistingLock' in object lock data to be true.

Request Information

Parameters
Name Type Required Description
objecttypeid Integer Yes The id of the type of object.

Array of Integers passed in the body of the request.

Example request body:

[
    847,
    2395843
]

Response Information

Example - 200
application/json, text/json
[
    {
        "ObjectTypeID":3,
        "ObjectID":847,
        "PolarisUserID":1,
        "WorkstationID":1,
        "LockDate":"2016-01-15T16:01:16.857-05:00",
        "PolarisUserName":"PolarisExec",
        "WorkstationName":"Anonymous OPAC Workstation",
        "ExistingLock":true,
        "LockExistsInDatabase": true
    },
    {
        "ObjectTypeID":3,
        "ObjectID":4972,
        "PolarisUserID":1,
        "WorkstationID":1,
        "LockDate":"2016-01-15T16:01:16.863-05:00",
        "PolarisUserName":"PolarisExec",
        "WorkstationName":"Anonymous OPAC Workstation",
        "ExistingLock":true,
        "LockExistsInDatabase": true
    }
]

HTTP Response Codes

Code Description
200 OK. Object successfully locked.
409 FAIL. Object is already locked by another user.