Circulation Rules (v1.1)

http://localhost:9130

Table of contents

Circulation Rules API

API for circulation Rules

/circulation

GET /circulation/rules

Get the circulation rules

GET /circulation/rules

Response 200

Body

Media type: application/json

Type:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Circulation Rules",
  "description": "Circulation rules record",
  "type": "object",
  "properties": {
    "id": {
      "description": "ID of the circulation rules (should only ever be a single record)",
      "type": "string"
    },
    "rulesAsText": {
      "description": "Circulation rules represented in text using the bespoke format",
      "type": "string"
    }
  },
  "additionalProperties": false,
  "required": [
    "rulesAsText"
  ]
}

Example:

{
  "rulesAsText": "priority: t, s, c, b, a, m, g\\nfallback-policy: l ffffffff-2222-4b5e-a7bd-064b8d177231 r ffffffff-3333-4ccf-b0f0-13db36bc1668 n ffffffff-4444-4da6-beae-73cb39e27cf1\\nm aaaaaaaa-1111-4b5e-a7bd-064b8d177231: l ffffffff-5555-4b5e-a7bd-064b8d177231 r ffffffff-6666-4c7a-a2cb-289d0aad2539 n ffffffff-7777-48ca-bd3a-90a0520068d7\\n    g cccccccc-1111-4b5e-a7bd-064b8d177231: l ffffffff-8888-4b5e-a7bd-064b8d177231 r ffffffff-9999-4f5a-b338-3a7e8d49b802 n ffffffff-0000-4cb8-a010-e589f8958eb5"
}

Response 500

Internal server error

Body

Media type: text/plain

Type: any

Example:

Internal server error

PUT /circulation/rules

Set the circulation rules using a text file

PUT /circulation/rules
Body

Media type: application/json

Type:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Circulation Rules",
  "description": "Circulation rules record",
  "type": "object",
  "properties": {
    "id": {
      "description": "ID of the circulation rules (should only ever be a single record)",
      "type": "string"
    },
    "rulesAsText": {
      "description": "Circulation rules represented in text using the bespoke format",
      "type": "string"
    }
  },
  "additionalProperties": false,
  "required": [
    "rulesAsText"
  ]
}

Example:

{
  "rulesAsText": "priority: t, s, c, b, a, m, g\\nfallback-policy: l ffffffff-2222-4b5e-a7bd-064b8d177231 r ffffffff-3333-4ccf-b0f0-13db36bc1668 n ffffffff-4444-4da6-beae-73cb39e27cf1\\nm aaaaaaaa-1111-4b5e-a7bd-064b8d177231: l ffffffff-5555-4b5e-a7bd-064b8d177231 r ffffffff-6666-4c7a-a2cb-289d0aad2539 n ffffffff-7777-48ca-bd3a-90a0520068d7\\n    g cccccccc-1111-4b5e-a7bd-064b8d177231: l ffffffff-8888-4b5e-a7bd-064b8d177231 r ffffffff-9999-4f5a-b338-3a7e8d49b802 n ffffffff-0000-4cb8-a010-e589f8958eb5"
}

Response 204

Circulation rules have been saved.

Response 422

Validation error in the text file.

Body

Media type: application/json

Type:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Circulation Rules Error Schema",
  "description": "Describes an error within the circulation rules",
  "type": "object",
  "properties": {
    "message": {
      "description": "Description of the error",
      "type": "string"
    },
    "line": {
      "description": "Line where the error occurred",
      "type": "integer"
    },
    "column": {
      "description": "Column where the error occurred",
      "type": "integer"
    }
  },
  "additionalProperties": false,
  "required": [
    "message",
    "line",
    "column"
  ]
}

Example:

{
  "message": "One of the keywords t, a, b, c, s, m, g, fallback-policy, priority or the character # expected, but found: foobar",
  "line": 1,
  "column": 1
}

Response 500

Internal server error

Body

Media type: text/plain

Type: any

Example:

Internal server error

GET /circulation/rules/loan-policy

Execute circulation rules and return the loan policy that will be applied, either the matching loan policy with the highest priority or the fallback loan policy

GET /circulation/rules/loan-policy
Query Parameters
  • item_type_id: required (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}$)

    Item type id

  • loan_type_id: required (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}$)

    Loan type id

  • patron_type_id: required (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}$)

    Patron type id

  • location_id: required (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}$)

    Location id

Response 200

Body

Media type: application/json

Type:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Result of applying circulation rules to determine a loan policy",
  "description": "Describes the outcome of applying loan rules to determine a loan policy",
  "type": "object",
  "properties": {
    "loanPolicyId": {
      "description": "ID of the loan policy determined by the circulation rules",
      "type": "string"
    },
    "appliedRuleConditions": {
      "description": "Addition information about conditions which were present in the applied rule",
      "type": "object",
      "properties": {
        "materialTypeMatch": {
          "description": "Indicates that ItemType was present in applied rule conditions",
          "type": "boolean"
        },
        "loanTypeMatch": {
          "description": "Indicates that LoanType was present in applied rule conditions",
          "type": "boolean"
        },
        "patronGroupMatch": {
          "description": "Indicates that PatronGroup was present in applied rule conditions",
          "type": "boolean"
        }
      }
    }
  },
  "additionalProperties": false,
  "required": [
    "loanPolicyId"
  ]
}

Example:

{
  "loanPolicyId": "d9cd0bed-1b49-4b5e-a7bd-064b8d177231"
}

Response 400

Invalid query parameters

Body

Media type: text/plain

Type: any

Example:

required query parameter missing: item_type_id

Response 422

Invalid id error.

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "error.schema",
  "description": "An error",
  "type": "object",
  "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"
  ]
}

Example:

{
  "message": "Patron type id does not exist: 99"
}

Response 500

Internal server error

Body

Media type: text/plain

Type: any

Example:

Internal server error

GET /circulation/rules/loan-policy-all

Execute circulation rules and return all matching loan policies in decreasing priority and the fallback loan policy

GET /circulation/rules/loan-policy-all
Query Parameters
  • item_type_id: required (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}$)

    Item type id

  • loan_type_id: required (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}$)

    Loan type id

  • patron_type_id: required (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}$)

    Patron type id

  • location_id: required (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}$)

    Location id

  • rules: (string)

    Circulation rules if provided, otherwise use stored circulation rules

Response 200

Body

Media type: application/json

Type:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Circulation policy ids schema",
  "description": "All rule matches from an application of the rules",
  "type": "object",
  "properties": {
    "ruleMatches": {
      "id": "ruleMatches",
      "description": "Set of all rule matches",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "circulation-rule-loan-policy-match.json"
      }
    }
  },
  "additionalProperties": false,
  "required": [
    "ruleMatches"
  ]
}

Example:

{
  "ruleMatches": [
    {
      "ruleLine": 7,
      "loanPolicyId": "d9cd0bed-1b49-4b5e-a7bd-064b8d177231"
    },
    {
      "ruleLine": 4,
      "loanPolicyId": "5e3bf628-cf74-48c2-ae8e-fe1bdc8d6220"
    },
    {
      "ruleLine": 1,
      "loanPolicyId": "7df77ebc-6dd3-425c-a00a-82c1ae930f72"
    }
  ]
}

Response 422

Invalid id error.

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "error.schema",
  "description": "An error",
  "type": "object",
  "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"
  ]
}

Example:

{
  "message": "Patron type id does not exist: 99"
}

Response 500

Internal server error

Body

Media type: text/plain

Type: any

Example:

Internal server error

GET /circulation/rules/overdue-fine-policy

Execute circulation rules and return the overdue fine policy that will be applied, either the matching overdue fine policy with the highest priority or the fallback overdue fine policy policy

GET /circulation/rules/overdue-fine-policy
Query Parameters
  • item_type_id: required (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}$)

    Item type id

  • loan_type_id: required (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}$)

    Loan type id

  • patron_type_id: required (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}$)

    Patron type id

  • location_id: required (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}$)

    Location id

Response 200

Body

Media type: application/json

Type:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Result of applying circulation rules to determine a overdue fine policy",
  "description": "Describes the outcome of applying loan rules to determine a overdue fine policy",
  "type": "object",
  "properties": {
    "overdueFinePolicyId": {
      "description": "ID of the overdue fine policy determined by the circulation rules",
      "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}$"
    }
  },
  "additionalProperties": false,
  "required": [
    "overdueFinePolicyId"
  ]
}

Example:

{
  "overdueFinePolicyId": "d9cd0bed-1b49-4b5e-a7bd-064b8d177231"
}

Response 400

Invalid query parameters

Body

Media type: text/plain

Type: any

Example:

required query parameter missing: item_type_id

Response 422

Invalid id error.

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "error.schema",
  "description": "An error",
  "type": "object",
  "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"
  ]
}

Example:

{
  "message": "Patron type id does not exist: 99"
}

Response 500

Internal server error

Body

Media type: text/plain

Type: any

Example:

Internal server error

GET /circulation/rules/overdue-fine-policy-all

Execute circulation rules and return all matching overdue fine policies in decreasing priority and the fallback overdue fine policy

GET /circulation/rules/overdue-fine-policy-all
Query Parameters
  • item_type_id: required (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}$)

    Item type id

  • loan_type_id: required (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}$)

    Loan type id

  • patron_type_id: required (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}$)

    Patron type id

  • location_id: required (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}$)

    Location id

  • rules: (string)

    Circulation rules if provided, otherwise use stored circulation rules

Response 200

Body

Media type: application/json

Type:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Circulation overdue fine policy ids schema",
  "description": "All rule matches from an application of the rules",
  "type": "object",
  "properties": {
    "ruleMatches": {
      "id": "ruleMatches",
      "description": "Set of all rule matches",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "circulation-rule-overdue-fine-policy-match.json"
      }
    }
  },
  "additionalProperties": false,
  "required": [
    "ruleMatches"
  ]
}

Example:

{
  "ruleMatches": [
    {
      "ruleLine": 8,
      "overdueFinePolicyId": "d9cd0bed-1b49-4b5e-a7bd-064b8d177231"
    },
    {
      "ruleLine": 5,
      "overdueFinePolicyId": "5e3bf628-cf74-48c2-ae8e-fe1bdc8d6220"
    },
    {
      "ruleLine": 2,
      "overdueFinePolicyId": "7df77ebc-6dd3-425c-a00a-82c1ae930f72"
    }
  ]
}

Response 422

Invalid id error.

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "error.schema",
  "description": "An error",
  "type": "object",
  "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"
  ]
}

Example:

{
  "message": "Patron type id does not exist: 99"
}

Response 500

Internal server error

Body

Media type: text/plain

Type: any

Example:

Internal server error

GET /circulation/rules/lost-item-policy

Execute circulation rules and return the lost item policy that will be applied, either the matching lost item policy with the highest priority or the fallback lost item policy policy

GET /circulation/rules/lost-item-policy
Query Parameters
  • item_type_id: required (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}$)

    Item type id

  • loan_type_id: required (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}$)

    Loan type id

  • patron_type_id: required (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}$)

    Patron type id

  • location_id: required (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}$)

    Location id

Response 200

Body

Media type: application/json

Type:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Result of applying circulation rules to determine a lost item policy",
  "description": "Describes the outcome of applying loan rules to determine a lost item policy",
  "type": "object",
  "properties": {
    "lostItemPolicyId": {
      "description": "ID of the lost item policy determined by the circulation rules",
      "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}$"
    }
  },
  "additionalProperties": false,
  "required": [
    "lostItemPolicyId"
  ]
}

Example:

{
  "lostItemPolicyId": "d9cd0bed-1b49-4b5e-a7bd-064b8d177231"
}

Response 400

Invalid query parameters

Body

Media type: text/plain

Type: any

Example:

required query parameter missing: item_type_id

Response 422

Invalid id error.

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "error.schema",
  "description": "An error",
  "type": "object",
  "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"
  ]
}

Example:

{
  "message": "Patron type id does not exist: 99"
}

Response 500

Internal server error

Body

Media type: text/plain

Type: any

Example:

Internal server error

GET /circulation/rules/lost-item-policy-all

Execute circulation rules and return all matching lost item policies in decreasing priority and the fallback lost item policy

GET /circulation/rules/lost-item-policy-all
Query Parameters
  • item_type_id: required (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}$)

    Item type id

  • loan_type_id: required (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}$)

    Loan type id

  • patron_type_id: required (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}$)

    Patron type id

  • location_id: required (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}$)

    Location id

  • rules: (string)

    Circulation rules if provided, otherwise use stored circulation rules

Response 200

Body

Media type: application/json

Type:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Circulation lost item policy ids schema",
  "description": "All rule matches from an application of the rules",
  "type": "object",
  "properties": {
    "ruleMatches": {
      "id": "ruleMatches",
      "description": "Set of all rule matches",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "circulation-rule-lost-item-policy-match.json"
      }
    }
  },
  "additionalProperties": false,
  "required": [
    "ruleMatches"
  ]
}

Example:

{
  "ruleMatches": [
    {
      "ruleLine": 9,
      "lostItemPolicyId": "d9cd0bed-1b49-4b5e-a7bd-064b8d177231"
    },
    {
      "ruleLine": 3,
      "lostItemPolicyId": "5e3bf628-cf74-48c2-ae8e-fe1bdc8d6220"
    },
    {
      "ruleLine": 1,
      "lostItemPolicyId": "7df77ebc-6dd3-425c-a00a-82c1ae930f72"
    }
  ]
}

Response 422

Invalid id error.

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "error.schema",
  "description": "An error",
  "type": "object",
  "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"
  ]
}

Example:

{
  "message": "Patron type id does not exist: 99"
}

Response 500

Internal server error

Body

Media type: text/plain

Type: any

Example:

Internal server error

GET /circulation/rules/request-policy

Execute circulation rules and return the request policy that will be applied, either the matching request policy with the highest priority or the fallback request policy

GET /circulation/rules/request-policy
Query Parameters
  • item_type_id: required (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}$)

    Item type id

  • loan_type_id: required (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}$)

    Loan type id

  • patron_type_id: required (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}$)

    Patron type id

  • location_id: required (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}$)

    Location id

Response 200

Body

Media type: application/json

Type:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Result of applying circulation rules to determine a request policy",
  "description": "Describes the outcome of applying circulation rules to determine a request policy",
  "type": "object",
  "properties": {
    "requestPolicyId": {
      "description": "ID of the request policy determined by the circulation rules",
      "type": "string"
    },
    "appliedRuleConditions": {
      "description": "Addition information about conditions which were present in the applied rule",
      "type": "object",
      "properties": {
        "materialTypeMatch": {
          "description": "Indicates that ItemType was present in applied rule conditions",
          "type": "boolean"
        },
        "loanTypeMatch": {
          "description": "Indicates that LoanType was present in applied rule conditions",
          "type": "boolean"
        },
        "patronGroupMatch": {
          "description": "Indicates that PatronGroup was present in applied rule conditions",
          "type": "boolean"
        }
      }
    }
  },
  "additionalProperties": false,
  "required": [
    "requestPolicyId"
  ]
}

Example:

{
  "requestPolicyId": "4c6e1fb0-2ef1-4666-bd15-f9190ff89060"
}

Response 400

Invalid query parameters

Body

Media type: text/plain

Type: any

Example:

required query parameter missing: item_type_id

Response 422

Invalid id error.

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "error.schema",
  "description": "An error",
  "type": "object",
  "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"
  ]
}

Example:

{
  "message": "Patron type id does not exist: 99"
}

Response 500

Internal server error

Body

Media type: text/plain

Type: any

Example:

Internal server error

GET /circulation/rules/request-policy-all

Execute circulation rules and return all matching request policies policies in decreasing priority and the fallback request policy

GET /circulation/rules/request-policy-all
Query Parameters
  • item_type_id: required (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}$)

    Item type id

  • loan_type_id: required (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}$)

    Loan type id

  • patron_type_id: required (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}$)

    Patron type id

  • location_id: required (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}$)

    Location id

  • rules: (string)

    Circulation rules if provided, otherwise use stored circulation rules

Response 200

Body

Media type: application/json

Type:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Circulation policy ids schema",
  "description": "All rule matches from an application of the rules",
  "type": "object",
  "properties": {
    "ruleMatches": {
      "id": "ruleMatches",
      "description": "Set of all rule matches",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "circulation-rule-request-policy-match.json"
      }
    }
  },
  "additionalProperties": false,
  "required": [
    "ruleMatches"
  ]
}

Example:

{
  "ruleMatches": [
    {
      "ruleLine": 4,
      "requestPolicyId": "334e5a9e-94f9-4673-8d1d-ab552863886b"
    },
    {
      "ruleLine": 1,
      "requestPolicyId": "4c6e1fb0-2ef1-4666-bd15-f9190ff89060"
    }
  ]
}

Response 422

Invalid id error.

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "error.schema",
  "description": "An error",
  "type": "object",
  "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"
  ]
}

Example:

{
  "message": "Patron type id does not exist: 99"
}

Response 500

Internal server error

Body

Media type: text/plain

Type: any

Example:

Internal server error

GET /circulation/rules/notice-policy

Get the notice policy when applying circulation rules

GET /circulation/rules/notice-policy
Query Parameters
  • item_type_id: required (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}$)

    Item type id

  • loan_type_id: required (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}$)

    Loan type id

  • patron_type_id: required (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}$)

    Patron type id

  • location_id: required (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}$)

    Location id

Response 200

Body

Media type: application/json

Type:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Result of applying circulation rules to determine a notice policy",
  "description": "Describes the outcome of applying circulation rules to determine a notice policy",
  "type": "object",
  "properties": {
    "noticePolicyId": {
      "description": "ID of the notice policy determined by the circulation rules",
      "type": "string"
    },
    "appliedRuleConditions": {
      "description": "Addition information about conditions which were present in the applied rule",
      "type": "object",
      "properties": {
        "materialTypeMatch": {
          "description": "Indicates that ItemType was present in applied rule conditions",
          "type": "boolean"
        },
        "loanTypeMatch": {
          "description": "Indicates that LoanType was present in applied rule conditions",
          "type": "boolean"
        },
        "patronGroupMatch": {
          "description": "Indicates that PatronGroup was present in applied rule conditions",
          "type": "boolean"
        }
      }
    }
  },
  "additionalProperties": false,
  "required": [
    "noticePolicyId"
  ]
}

Example:

{
  "noticePolicyId": "122b3d2b-4788-4f1e-9117-56daa91cb75c"
}

Response 400

Invalid query parameters

Body

Media type: text/plain

Type: any

Example:

required query parameter missing: item_type_id

Response 422

Invalid id error.

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "error.schema",
  "description": "An error",
  "type": "object",
  "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"
  ]
}

Example:

{
  "message": "Patron type id does not exist: 99"
}

Response 500

Internal server error

Body

Media type: text/plain

Type: any

Example:

Internal server error

GET /circulation/rules/notice-policy-all

Get notice policy for each match when applying circulation rules

GET /circulation/rules/notice-policy-all
Query Parameters
  • item_type_id: required (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}$)

    Item type id

  • loan_type_id: required (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}$)

    Loan type id

  • patron_type_id: required (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}$)

    Patron type id

  • location_id: required (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}$)

    Location id

  • rules: (string)

    Circulation rules if provided, otherwise use stored circulation rules

Response 200

Body

Media type: application/json

Type:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "title": "Circulation policy ids schema",
  "description": "All rule matches from an application of the rules",
  "type": "object",
  "properties": {
    "ruleMatches": {
      "id": "ruleMatches",
      "description": "Set of all rule matches",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "circulation-rule-notice-policy-match.json"
      }
    }
  },
  "additionalProperties": false,
  "required": [
    "ruleMatches"
  ]
}

Example:

{
  "ruleMatches": [
    {
      "ruleLine": 4,
      "noticePolicyId": "16b88363-0d93-464a-967a-ad5ad0f9187c"
    },
    {
      "ruleLine": 1,
      "noticePolicyId": "122b3d2b-4788-4f1e-9117-56daa91cb75c"
    }
  ]
}

Response 422

Invalid id error.

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "error.schema",
  "description": "An error",
  "type": "object",
  "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"
  ]
}

Example:

{
  "message": "Patron type id does not exist: 99"
}

Response 500

Internal server error

Body

Media type: text/plain

Type: any

Example:

Internal server error