Loan Policy Storage (v1.4)

http://localhost:9130

Table of contents

Loan Policy Storage API

Storage for loan policies

/loan-policy-storage

GET /loan-policy-storage/loan-policies

Retrieve a list of loan-policy items.

GET /loan-policy-storage/loan-policies
Query Parameters
  • offset: (integer - default: 0 - minimum: 0 - maximum: 2147483647)

    Skip over a number of elements by specifying an offset value for the query

    Example:

    0
  • limit: (integer - default: 10 - minimum: 0 - maximum: 2147483647)

    Limit the number of elements returned in the response

    Example:

    10
  • query: (string)

    A query expressed as a CQL string (see dev.folio.org/reference/glossary#cql) using valid searchable fields. The first example below shows the general form of a full CQL query, but those fields might not be relevant in this context.

    searchable using CQL

    Example:

    (username=="ab*" or personal.firstName=="ab*" or personal.lastName=="ab*") and active=="true" sortby personal.lastName personal.firstName barcode
    
    id="cf23adf0-61ba-4887-bf82-956c4aae2260"
    
  • lang: (string - default: en - pattern: [a-zA-Z]{2})

    Requested language. Optional. [lang=en]

Response 200

Returns a list of loan-policy items

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Collection of loan policies",
  "type": "object",
  "properties": {
    "loanPolicies": {
      "description": "List of items",
      "id": "loanPolicies",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "loan-policy.json"
      }
    },
    "totalRecords": {
      "type": "integer"
    }
  },
  "required": [
    "loanPolicies",
    "totalRecords"
  ]
}

Example:

{
  "loanPolicies": [
    {
      "id": "d9cd0bed-1b49-4b5e-a7bd-064b8d177231",
      "name": "Example Loan Policy",
      "description": "An example loan policy",
      "loanable": true,
      "loansPolicy": {
        "profileId": "Rolling",
        "period": {
          "duration": 1,
          "intervalId": "Months"
        },
        "closedLibraryDueDateManagementId": "KEEP_CURRENT_DATE",
        "existingRequestsPeriod": {
          "duration": 1,
          "intervalId": "Weeks"
        },
        "gracePeriod": {
          "duration": 7,
          "intervalId": "Days"
        }
      },
      "renewable": true,
      "renewalsPolicy": {
        "unlimited": false,
        "numberAllowed": 3,
        "renewFromId": "CURRENT_DUE_DATE",
        "differentPeriod": true,
        "period": {
          "duration": 30,
          "intervalId": "Days"
        }
      }
    },
    {
      "id": "0df935eb-f3f4-4741-9ac6-33c500174b96",
      "name": "A minimal loan policy",
      "loanable": true,
      "renewable": false
    }
  ],
  "totalRecords": 2
}

Response 400

Bad request, e.g. malformed request body or query parameter. Details of the error (e.g. name of the parameter or line/character number with malformed data) provided in the response.

Body

Media type: text/plain

Type: any

Example:

unable to list loan-policies -- malformed parameter 'query', syntax error at column 6

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Example:

unable to list loan-policies -- unauthorized

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

internal server error, contact administrator

Response 501

Not implemented yet

POST /loan-policy-storage/loan-policies

Create a new loan-policy item.

POST /loan-policy-storage/loan-policies
Query Parameters
  • lang: (string - default: en - pattern: [a-zA-Z]{2})

    Requested language. Optional. [lang=en]

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "loanable": {
      "type": "boolean"
    },
    "loansPolicy": {
      "type": "object",
      "properties": {
        "profileId": {
          "type": "string",
          "description": "Loan profile"
        },
        "period": {
          "type": "object",
          "$ref": "period.json",
          "description": "Loan period"
        },
        "closedLibraryDueDateManagementId": {
          "type": "string",
          "description": "Closed library due date management"
        },
        "existingRequestsPeriod": {
          "type": "object",
          "$ref": "period.json",
          "description": "Alternate loan period for items with existing requests"
        },
        "gracePeriod": {
          "type": "object",
          "$ref": "period.json",
          "description": "Grace period"
        },
        "openingTimeOffset": {
          "type": "object",
          "$ref": "period.json",
          "description": "Opening offset time period"
        },
        "fixedDueDateScheduleId": {
          "type": "string",
          "description": "Fixed due date schedule (due date limit)"
        }
      }
    },
    "renewable": {
      "type": "boolean",
      "description": "Is item renewable"
    },
    "renewalsPolicy": {
      "type": "object",
      "properties": {
        "unlimited": {
          "type": "boolean",
          "description": "Unlimited renewals"
        },
        "numberAllowed": {
          "type": "number",
          "description": "Number of renewals allowed"
        },
        "renewFromId": {
          "type": "string",
          "description": "Renew from date"
        },
        "differentPeriod": {
          "type": "boolean",
          "description": "Renewal period different from original loan"
        },
        "period": {
          "type": "object",
          "$ref": "period.json",
          "description": "Alternate loan period for renewals"
        },
        "alternateFixedDueDateScheduleId": {
          "type": "string",
          "description": "Alternate fixed due date schedule (due date limit) for renewals"
        }
      }
    },
    "metadata": {
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "name",
    "loanable",
    "renewable"
  ]
}

Example:

{
  "id": "d9cd0bed-1b49-4b5e-a7bd-064b8d177231",
  "name": "Example Loan Policy",
  "description": "An example loan policy",
  "loanable": true,
  "loansPolicy": {
    "profileId": "Rolling",
    "period": {
      "duration": 1,
      "intervalId": "Months"
    },
    "closedLibraryDueDateManagementId": "KEEP_CURRENT_DATE",
    "existingRequestsPeriod": {
      "duration": 1,
      "intervalId": "Weeks"
    },
    "gracePeriod": {
      "duration": 7,
      "intervalId": "Days"
    }
  },
  "renewable": true,
  "renewalsPolicy": {
    "unlimited": true,
    "renewFromId": "CURRENT_DUE_DATE",
    "differentPeriod": true,
    "period": {
      "duration": 30,
      "intervalId": "Days"
    }
  }
}

Response 201

Returns a newly created item, with server-controlled fields like 'id' populated

Headers
  • Location: required (string)

    URI to the created loan-policy item

Body

Media type: application/json

Type: any

Example:

{
  "id": "d9cd0bed-1b49-4b5e-a7bd-064b8d177231",
  "name": "Example Loan Policy",
  "description": "An example loan policy",
  "loanable": true,
  "loansPolicy": {
    "profileId": "Rolling",
    "period": {
      "duration": 1,
      "intervalId": "Months"
    },
    "closedLibraryDueDateManagementId": "KEEP_CURRENT_DATE",
    "existingRequestsPeriod": {
      "duration": 1,
      "intervalId": "Weeks"
    },
    "gracePeriod": {
      "duration": 7,
      "intervalId": "Days"
    }
  },
  "renewable": true,
  "renewalsPolicy": {
    "unlimited": true,
    "renewFromId": "CURRENT_DUE_DATE",
    "differentPeriod": true,
    "period": {
      "duration": 30,
      "intervalId": "Days"
    }
  }
}

Response 400

Bad request, e.g. malformed request body or query parameter. Details of the error (e.g. name of the parameter or line/character number with malformed data) provided in the response.

Body

Media type: text/plain

Type: any

Example:

"unable to add loan-policy -- malformed JSON at 13:3"

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Example:

unable to create loan-policies -- unauthorized

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

Internal server error, contact administrator

Response 501

Not implemented yet

DELETE /loan-policy-storage/loan-policies

DELETE /loan-policy-storage/loan-policies
Query Parameters
  • lang: (string - default: en - pattern: [a-zA-Z]{2})

    Requested language. Optional. [lang=en]

Response 204

All loans deleted

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

Internal server error, contact administrator

Response 501

Not implemented yet

GET /loan-policy-storage/loan-policies/{loanPolicyId}

Retrieve loan-policy item with given {loan-policyId}

GET /loan-policy-storage/loan-policies/{loanPolicyId}
URI Parameters
  • loanPolicyId: required (string)
Query Parameters
  • lang: (string - default: en - pattern: [a-zA-Z]{2})

    Requested language. Optional. [lang=en]

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",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "loanable": {
      "type": "boolean"
    },
    "loansPolicy": {
      "type": "object",
      "properties": {
        "profileId": {
          "type": "string",
          "description": "Loan profile"
        },
        "period": {
          "type": "object",
          "$ref": "period.json",
          "description": "Loan period"
        },
        "closedLibraryDueDateManagementId": {
          "type": "string",
          "description": "Closed library due date management"
        },
        "existingRequestsPeriod": {
          "type": "object",
          "$ref": "period.json",
          "description": "Alternate loan period for items with existing requests"
        },
        "gracePeriod": {
          "type": "object",
          "$ref": "period.json",
          "description": "Grace period"
        },
        "openingTimeOffset": {
          "type": "object",
          "$ref": "period.json",
          "description": "Opening offset time period"
        },
        "fixedDueDateScheduleId": {
          "type": "string",
          "description": "Fixed due date schedule (due date limit)"
        }
      }
    },
    "renewable": {
      "type": "boolean",
      "description": "Is item renewable"
    },
    "renewalsPolicy": {
      "type": "object",
      "properties": {
        "unlimited": {
          "type": "boolean",
          "description": "Unlimited renewals"
        },
        "numberAllowed": {
          "type": "number",
          "description": "Number of renewals allowed"
        },
        "renewFromId": {
          "type": "string",
          "description": "Renew from date"
        },
        "differentPeriod": {
          "type": "boolean",
          "description": "Renewal period different from original loan"
        },
        "period": {
          "type": "object",
          "$ref": "period.json",
          "description": "Alternate loan period for renewals"
        },
        "alternateFixedDueDateScheduleId": {
          "type": "string",
          "description": "Alternate fixed due date schedule (due date limit) for renewals"
        }
      }
    },
    "metadata": {
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "name",
    "loanable",
    "renewable"
  ]
}

Example:

{
  "id": "d9cd0bed-1b49-4b5e-a7bd-064b8d177231",
  "name": "Example Loan Policy",
  "description": "An example loan policy",
  "loanable": true,
  "loansPolicy": {
    "profileId": "Rolling",
    "period": {
      "duration": 1,
      "intervalId": "Months"
    },
    "closedLibraryDueDateManagementId": "KEEP_CURRENT_DATE",
    "existingRequestsPeriod": {
      "duration": 1,
      "intervalId": "Weeks"
    },
    "gracePeriod": {
      "duration": 7,
      "intervalId": "Days"
    }
  },
  "renewable": true,
  "renewalsPolicy": {
    "unlimited": true,
    "renewFromId": "CURRENT_DUE_DATE",
    "differentPeriod": true,
    "period": {
      "duration": 30,
      "intervalId": "Days"
    }
  }
}

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"loan-policy not found"

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

internal server error, contact administrator

Response 501

Not implemented yet

PUT /loan-policy-storage/loan-policies/{loanPolicyId}

Update loan-policy item with given {loan-policyId}

PUT /loan-policy-storage/loan-policies/{loanPolicyId}
URI Parameters
  • loanPolicyId: required (string)
Query Parameters
  • lang: (string - default: en - pattern: [a-zA-Z]{2})

    Requested language. Optional. [lang=en]

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "loanable": {
      "type": "boolean"
    },
    "loansPolicy": {
      "type": "object",
      "properties": {
        "profileId": {
          "type": "string",
          "description": "Loan profile"
        },
        "period": {
          "type": "object",
          "$ref": "period.json",
          "description": "Loan period"
        },
        "closedLibraryDueDateManagementId": {
          "type": "string",
          "description": "Closed library due date management"
        },
        "existingRequestsPeriod": {
          "type": "object",
          "$ref": "period.json",
          "description": "Alternate loan period for items with existing requests"
        },
        "gracePeriod": {
          "type": "object",
          "$ref": "period.json",
          "description": "Grace period"
        },
        "openingTimeOffset": {
          "type": "object",
          "$ref": "period.json",
          "description": "Opening offset time period"
        },
        "fixedDueDateScheduleId": {
          "type": "string",
          "description": "Fixed due date schedule (due date limit)"
        }
      }
    },
    "renewable": {
      "type": "boolean",
      "description": "Is item renewable"
    },
    "renewalsPolicy": {
      "type": "object",
      "properties": {
        "unlimited": {
          "type": "boolean",
          "description": "Unlimited renewals"
        },
        "numberAllowed": {
          "type": "number",
          "description": "Number of renewals allowed"
        },
        "renewFromId": {
          "type": "string",
          "description": "Renew from date"
        },
        "differentPeriod": {
          "type": "boolean",
          "description": "Renewal period different from original loan"
        },
        "period": {
          "type": "object",
          "$ref": "period.json",
          "description": "Alternate loan period for renewals"
        },
        "alternateFixedDueDateScheduleId": {
          "type": "string",
          "description": "Alternate fixed due date schedule (due date limit) for renewals"
        }
      }
    },
    "metadata": {
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "name",
    "loanable",
    "renewable"
  ]
}

Example:

{
  "id": "d9cd0bed-1b49-4b5e-a7bd-064b8d177231",
  "name": "Example Loan Policy",
  "description": "An example loan policy",
  "loanable": true,
  "loansPolicy": {
    "profileId": "Rolling",
    "period": {
      "duration": 1,
      "intervalId": "Months"
    },
    "closedLibraryDueDateManagementId": "KEEP_CURRENT_DATE",
    "existingRequestsPeriod": {
      "duration": 1,
      "intervalId": "Weeks"
    },
    "gracePeriod": {
      "duration": 7,
      "intervalId": "Days"
    }
  },
  "renewable": true,
  "renewalsPolicy": {
    "unlimited": true,
    "renewFromId": "CURRENT_DUE_DATE",
    "differentPeriod": true,
    "period": {
      "duration": 30,
      "intervalId": "Days"
    }
  }
}

Response 204

Item successfully updated

Response 400

Bad request, e.g. malformed request body or query parameter. Details of the error (e.g. name of the parameter or line/character number with malformed data) provided in the response.

Body

Media type: text/plain

Type: any

Example:

"unable to update loan-policy -- malformed JSON at 13:4"

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"loan-policy not found"

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

internal server error, contact administrator

Response 501

Not implemented yet

DELETE /loan-policy-storage/loan-policies/{loanPolicyId}

Delete loan-policy item with given {loan-policyId}

DELETE /loan-policy-storage/loan-policies/{loanPolicyId}
URI Parameters
  • loanPolicyId: required (string)
Query Parameters
  • lang: (string - default: en - pattern: [a-zA-Z]{2})

    Requested language. Optional. [lang=en]

Response 204

Item deleted successfully

Response 400

Bad request, e.g. malformed request body or query parameter. Details of the error (e.g. name of the parameter or line/character number with malformed data) provided in the response.

Body

Media type: text/plain

Type: any

Example:

"unable to delete loan-policy -- constraint violation"

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"loan-policy not found"

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

Internal server error, contact administrator

Response 501

Not implemented yet