Checkout Lock Storage (v1.0)

http://localhost:9130

Table of contents

Checkout Lock API

Storage for checkout lock

Checkout lock storage

GET /check-out-lock-storage

Retrieve a list of checkout lock items

GET /check-out-lock-storage
Query Parameters
  • userId: required (string)

    Filter locks by user ID.

  • offset: required (integer)

    The number of items to skip in the result set.

  • limit: required (integer)

    The maximum number of locks to return.

Response 200

Returns a list of checkout lock items

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Collection of checkoutLocks",
  "type": "object",
  "properties": {
    "checkoutLocks": {
      "description": "List of checkoutLocks",
      "id": "checkoutLocks",
      "type": "array",
      "items": {
        "type": "object",
        "$schema": "http://json-schema.org/draft-04/schema#",
        "description": "Checkout Lock",
        "properties": {
          "id": {
            "description": "ID of the lock",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "id": "uuid.schema",
            "type": "string",
            "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$"
          },
          "userId": {
            "description": "ID of the patron the lock is created for",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "id": "uuid.schema",
            "type": "string",
            "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$"
          },
          "creationDate": {
            "description": "Date and time of lock creation",
            "type": "string",
            "format": "date-time"
          }
        }
      }
    },
    "totalRecords": {
      "type": "integer"
    }
  },
  "required": [
    "checkoutLocks",
    "totalRecords"
  ]
}

Response 422

Invalid Parameters

Body

Media type: text/plain

Type: any

Example:

Invalid Parameters

POST /check-out-lock-storage

Create a lock for the given userid

POST /check-out-lock-storage
Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "description": "Checkout Lock",
  "properties": {
    "userId": {
      "description": "ID of the patron the lock is created for",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "id": "uuid.schema",
      "type": "string",
      "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$"
    },
    "ttlMs": {
      "description": "Time to live for lock object",
      "type": "integer"
    }
  }
}

Example:

{
  "userId": "77477611-ab44-4082-a0d8-42f7acdfde11",
  "ttl": 3000
}

Response 201

Checkout lock is created

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "description": "Checkout Lock",
  "properties": {
    "id": {
      "description": "ID of the lock",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "id": "uuid.schema",
      "type": "string",
      "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$"
    },
    "userId": {
      "description": "ID of the patron the lock is created for",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "id": "uuid.schema",
      "type": "string",
      "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$"
    },
    "creationDate": {
      "description": "Date and time of lock creation",
      "type": "string",
      "format": "date-time"
    }
  }
}

Example:

{
  "id": "0bab56e5-1ab6-4ac2-afdf-8b2df0434379",
  "userId": "77477611-ab44-4082-a0d8-42f7acdfde11",
  "creationDate": "2018-01-31T21:21:02Z"
}

Response 400

Bad Request

Body

Media type: text/plain

Type: any

Response 422

Validation errors

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "errors.schema",
  "description": "A set of errors",
  "type": "object",
  "properties": {
    "errors": {
      "description": "List of errors",
      "id": "errors",
      "type": "array",
      "items": {
        "type": "object",
        "$schema": "http://json-schema.org/draft-04/schema#",
        "id": "error.schema",
        "description": "An error",
        "properties": {
          "message": {
            "type": "string",
            "description": "Error message text"
          },
          "type": {
            "type": "string",
            "description": "Error message type"
          },
          "code": {
            "type": "string",
            "description": "Error message code"
          },
          "parameters": {
            "description": "Error message parameters",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "id": "parameters.schema",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "value": {
                  "type": "string"
                }
              }
            }
          }
        },
        "required": [
          "message"
        ]
      }
    },
    "total_records": {
      "description": "Total number of errors",
      "type": "integer"
    }
  }
}

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

Response 500

Internal server error

Body

Media type: text/plain

Type: any

Example:

Internal server error

Response 503

Failed to create lock for patron {userId}

Body

Media type: text/plain

Type: any

Example:

Failed to create lock for patron 

GET /check-out-lock-storage/{lockId}

Get checkout lock

GET /check-out-lock-storage/{lockId}
URI Parameters
  • lockId: required (string)

Response 200

Returns item with a given ID

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "description": "Checkout Lock",
  "properties": {
    "id": {
      "description": "ID of the lock",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "id": "uuid.schema",
      "type": "string",
      "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$"
    },
    "userId": {
      "description": "ID of the patron the lock is created for",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "id": "uuid.schema",
      "type": "string",
      "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[1-5][a-fA-F0-9]{3}-[89abAB][a-fA-F0-9]{3}-[a-fA-F0-9]{12}$"
    },
    "creationDate": {
      "description": "Date and time of lock creation",
      "type": "string",
      "format": "date-time"
    }
  }
}

Example:

{
  "id": "0bab56e5-1ab6-4ac2-afdf-8b2df0434379",
  "userId": "77477611-ab44-4082-a0d8-42f7acdfde11",
  "creationDate": "2018-01-31T21:21:02Z"
}

Response 400

Bad Request

Body

Media type: text/plain

Type: any

Response 404

Item with a given ID not found

DELETE /check-out-lock-storage/{lockId}

Delete checkout lock

DELETE /check-out-lock-storage/{lockId}
URI Parameters
  • lockId: required (string)

Response 204

Item deleted successfully

Response 500

Internal Server error

Body

Media type: text/plain

Type: any

Example:

Internal server error