Permalink
321 lines (315 sloc) 10.3 KB
#%RAML 0.8
title: Circulation
version: v3.4
protocols: [ HTTP, HTTPS ]
baseUri: http://localhost:9130
documentation:
- title: Circulation Business Logic API
content: <b>API for loans and requests</b>
schemas:
- loan.json: !include loan.json
- loans: !include loans.json
- request.json: !include request.json
- requests: !include requests.json
- raml-util/schemas/error.schema: !include raml-util/schemas/error.schema
- raml-util/schemas/metadata.schema: !include raml-util/schemas/metadata.schema
- errors: !include raml-util/schemas/errors.schema
- error.schema: !include raml-util/schemas/error.schema
- parameters.schema: !include raml-util/schemas/parameters.schema
traits:
- secured: !include raml-util/traits/auth.raml
- language: !include raml-util/traits/language.raml
- pageable: !include raml-util/traits/pageable.raml
- searchable: !include raml-util/traits/searchable.raml
- validate: !include raml-util/traits/validation.raml
resourceTypes:
- collection: !include raml-util/rtypes/collection.raml
- collection-item: !include raml-util/rtypes/item-collection.raml
/circulation:
/check-out-by-barcode:
displayName: Check out using barcode for item and loanee
post:
description: Creates a loan by checking out an item to a loanee
is: [
secured,
language,
validate
]
body:
application/json:
schema: !include check-out-by-barcode-request.json
example: !include examples/check-out-by-barcode-request.json
responses:
201:
body:
application/json:
schema: loan.json
example: !include examples/loan.json
500:
description: "Internal server error"
body:
text/plain:
example: "Internal server error"
/renew-by-barcode:
displayName: Renew an existing loan using barcode for item and loanee
post:
description: Updates the due date of an existing loan
is: [
secured,
language,
validate
]
body:
application/json:
schema: !include renew-by-barcode-request.json
example: !include examples/renew-by-barcode-request.json
responses:
201:
body:
application/json:
schema: loan.json
example: !include examples/loan.json
500:
description: "Internal server error"
body:
text/plain:
example: "Internal server error"
/renew-by-id:
displayName: Renew an existing loan using IDs of the item and loanee
post:
description: Updates the due date of an existing loan
is: [
secured,
language,
validate
]
body:
application/json:
schema: !include renew-by-id-request.json
example: !include examples/renew-by-id-request.json
responses:
201:
body:
application/json:
schema: loan.json
example: !include examples/loan.json
500:
description: "Internal server error"
body:
text/plain:
example: "Internal server error"
/loans:
displayName: Loans
type:
collection:
exampleCollection: !include examples/loans.json
exampleItem: !include examples/loan.json
schemaCollection: loans
schemaItem: loan.json
get:
is: [
pageable,
searchable: {description: "by title (using CQL)",
example: "userId=\"cf23adf0-61ba-4887-bf82-956c4aae2260\""}
]
responses:
501:
description: "Not implemented yet"
post:
delete:
responses:
204:
description: "All loans deleted"
500:
description: "Internal server error, e.g. due to misconfiguration"
body:
text/plain:
example: "Internal server error, contact administrator"
/{loanId}:
type:
collection-item:
exampleItem: !include examples/loan.json
schema: loan.json
get:
responses:
501:
description: "Not implemented yet"
put:
responses:
501:
description: "Not implemented yet"
delete:
responses:
501:
description: "Not implemented yet"
/loan-rules:
displayName: Loan rules
get:
description: Get the loan rules
is: [secured]
responses:
200:
body:
application/json:
schema: !include schema/loan-rules.json
example: !include examples/loan-rules.json
500:
description: "Internal server error"
body:
text/plain:
example: "Internal server error"
put:
description: Set the loan rules using a text file
is: [secured]
body:
application/json:
schema: !include schema/loan-rules-text.json
example: !include examples/loan-rules-text.json
responses:
204:
description: "Loan rules have been saved."
422:
description: "Validation error in the text file."
body:
application/json:
schema: !include schema/loan-rules-error.json
example: !include examples/loan-rules-error.json
500:
description: "Internal server error"
body:
text/plain:
example: "Internal server error"
/apply:
displayName: Apply loan rules
get:
description: Get the loan policy when applying loan rules
is: [secured]
queryParameters:
item_type_id:
description: "Item type id"
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}$"
required: true
loan_type_id:
description: "Loan type id"
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}$"
required: true
patron_type_id:
description: "Patron type id"
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}$"
required: true
shelving_location_id:
description: "Shelving location id"
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}$"
required: true
responses:
200:
body:
application/json:
schema: !include schema/loan-policy-id.json
example: !include examples/loan-policy-id.json
400:
description: "Invalid query parameters"
body:
text/plain:
example: "required query parameter missing: item_type_id"
422:
description: "Invalid id error."
body:
application/json:
schema: raml-util/schemas/error.schema
example: !include examples/loan-rules-id-error.json
500:
description: "Internal server error"
body:
text/plain:
example: "Internal server error"
/apply-all:
displayName: Apply loan rules and return all matches
get:
description: Get loan rule and loan policy for each match when applying loan rules
is: [secured]
queryParameters:
item_type_id:
description: "Item type id"
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}$"
required: true
loan_type_id:
description: "Loan type id"
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}$"
required: true
patron_type_id:
description: "Patron type id"
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}$"
required: true
shelving_location_id:
description: "Shelving location id"
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}$"
required: true
loan_rules:
description: "Loan rules if provided, otherwise use stored loan rules"
required: false
responses:
200:
body:
application/json:
schema: !include schema/loan-rule-matches.json
example: !include examples/loan-rule-matches.json
422:
description: "Invalid id error."
body:
application/json:
schema: raml-util/schemas/error.schema
example: !include examples/loan-rules-id-error.json
500:
description: "Internal server error"
body:
text/plain:
example: "Internal server error"
/requests:
displayName: Requests
type:
collection:
exampleCollection: !include examples/requests.json
exampleItem: !include examples/request.json
schemaCollection: requests
schemaItem: request.json
get:
is: [pageable,
searchable: {description: "by using CQL",
example: "requesterId=\"cf23adf0-61ba-4887-bf82-956c4aae2260\""}
]
responses:
501:
description: "Not implemented yet"
post:
responses:
501:
description: "Not implemented yet"
delete:
responses:
204:
description: "All requests deleted"
500:
description: "Internal server error, e.g. due to misconfiguration"
body:
text/plain:
example: "Internal server error, contact administrator"
501:
description: "Not implemented yet"
/{requestId}:
type:
collection-item:
exampleItem: !include examples/request.json
schema: request.json
get:
responses:
501:
description: "Not implemented yet"
put:
responses:
501:
description: "Not implemented yet"
delete:
responses:
501:
description: "Not implemented yet"