Automated patron blocks version v0.1
http://github.com/org/folio/mod-feesfines
API for checking if any automated patron blocks exist for patron
Automated patron blocks API
/automated-patron-blocks
get /automated-patron-blocks/{userId}
URI Parameters
- userId: required(string)
HTTP status code 200
Body
Media type: application/json
Example:
{
"automatedPatronBlocks": [
{
"patronBlockConditionId": "2149fff5-a64c-4943-aa79-bb1d09511382",
"blockBorrowing": true,
"blockRenewals": false,
"blockRequests": false,
"message": "Patron has reached maximum allowed number of items charged out"
},
{
"patronBlockConditionId": "ac13a725-b25f-48fa-84a6-4af021d13afe",
"blockBorrowing": false,
"blockRenewals": false,
"blockRequests": true,
"message": "Patron has reached maximum allowed outstanding fee/fine balance for his/her patron group"
}
]
}HTTP status code 400
Invalid user ID in request
Body
Media type: text/plain
Type: any
Example:
Bad request, e.g. invalid user UUIDHTTP status code 500
Internal server error, e.g. due to misconfiguration
Body
Media type: text/plain
Type: any
Example:
Internal server error, contact administratorBatch query for automated patron blocks for multiple user IDs
post /automated-patron-blocks/batch
Batch query for automated patron blocks for multiple user IDs
Body
Media type: application/json
Type: json
Content:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Automated Patron Blocks Batch Request",
"description": "Request payload containing patron IDs for batch block evaluation",
"type": "object",
"properties": {
"userIds": {
"type": "array",
"description": "List of user IDs to check automated patron blocks for",
"items": {
"type": "string",
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "uuid.schema",
"description": "A universally unique identifier (UUID), this is a 128-bit number used to identify a record and is shown in hex with dashes, for example 6312d172-f0cf-40f6-b27d-9fa8feaf332f; the UUID version must be from 1-5; see https://dev.folio.org/guides/uuids/",
"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}$"
},
"minItems": 1,
"maxItems": 1000
}
},
"required": [
"userIds"
],
"additionalProperties": false
}Example:
{
"userIds": [
"1ad4ebca-826a-49eb-b59c-dd9aa51fb873",
"29c4241e-61c4-4b55-b461-2fbef58fb8ea",
"3f1e948c-7f5d-4f05-b040-cfc072cfae8b",
"1ad4ebca-826a-49eb-b59c-dd9aa51fb873"
]
}
HTTP status code 200
Batch automated patron blocks query results
Body
Media type: application/json
Type: json
Content:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"title": "Automated Patron Blocks Batch Response",
"description": "Batch query response containing evaluation results and total distinct record count",
"type": "object",
"properties": {
"results": {
"type": "array",
"description": "Array of automated patron blocks results per distinct user ID",
"items": {
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema#",
"javaType": "org.folio.rest.jaxrs.model.AutomatedPatronBlocksBatchResult",
"title": "Automated Patron Blocks Batch Result",
"description": "Evaluation result for a single patron in a batch query",
"properties": {
"userId": {
"type": "string",
"description": "Unique ID of the patron",
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "uuid.schema",
"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}$"
},
"status": {
"type": "string",
"enum": [
"SUCCESS",
"ERROR"
],
"description": "Result status discriminator"
},
"automatedPatronBlocks": {
"type": "array",
"description": "Automated patron blocks when status is SUCCESS",
"items": {
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema#",
"description": "Single automated patron block",
"properties": {
"patronBlockConditionId": {
"type": "string",
"description": "Unique ID of patron block condition",
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "uuid.schema",
"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}$"
},
"blockBorrowing": {
"type": "boolean",
"description": "Indicates that borrowing is not allowed for patron"
},
"blockRenewals": {
"type": "boolean",
"description": "Indicates that renewals are not allowed for patron"
},
"blockRequests": {
"type": "boolean",
"description": "Indicates that requests are not allowed for patron"
},
"message": {
"type": "string",
"description": "Message to be displayed if the patron should be blocked"
}
},
"additionalProperties": false,
"required": [
"blockBorrowing",
"blockRenewals",
"blockRequests",
"message"
]
}
},
"error": {
"type": "object",
"description": "Structured error details when status is ERROR",
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "error.schema",
"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"
]
}
},
"required": [
"userId",
"status"
],
"additionalProperties": false
}
},
"totalRecords": {
"type": "integer",
"description": "Total number of distinct patrons represented in results"
}
},
"required": [
"results",
"totalRecords"
],
"additionalProperties": false
}Example:
{
"results": [
{
"userId": "1ad4ebca-826a-49eb-b59c-dd9aa51fb873",
"status": "SUCCESS",
"automatedPatronBlocks": [
{
"patronBlockConditionId": "2149fff5-a64c-4943-aa79-bb1d09511382",
"blockBorrowing": true,
"blockRenewals": false,
"blockRequests": false,
"message": "Patron has reached maximum allowed number of items charged out"
}
]
},
{
"userId": "29c4241e-61c4-4b55-b461-2fbef58fb8ea",
"status": "SUCCESS",
"automatedPatronBlocks": []
},
{
"userId": "3f1e948c-7f5d-4f05-b040-cfc072cfae8b",
"status": "ERROR",
"error": {
"message": "Failed to retrieve patron summary",
"type": "InternalError",
"code": "SUMMARY_RETRIEVAL_FAILED"
}
}
],
"totalRecords": 3
}
HTTP status code 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"
}
]
}
]
}
HTTP status code 500
Internal server error
Body
Media type: text/plain
Type: any
Example:
Internal server error, please contact administratorHTTP status code 501
Not implemented
Body
Media type: text/plain
Type: any
Example:
Not implementedpost /automated-patron-blocks/synchronization/job
Body
Media type: application/json
Type: json
Content:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"description": "Synchronization job schema",
"properties": {
"id": {
"description": "Synchronization job ID",
"type": "string",
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "uuid.schema",
"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}$"
},
"scope": {
"type": "string",
"description": "Scope of re-sync data",
"enum": [
"user",
"full"
]
},
"userId": {
"type": "string",
"description": "Users ID for if scope is [user]",
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "uuid.schema",
"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}$"
},
"status": {
"description": "Status of synchronization job",
"type": "string"
},
"totalNumberOfLoans": {
"description": "Total number of loans",
"type": "integer"
},
"totalNumberOfFeesFines": {
"description": "Total number of fees/fines",
"type": "integer"
},
"numberOfProcessedLoans": {
"description": "Total number of processed loans",
"type": "integer"
},
"numberOfProcessedFeesFines": {
"description": "Total number of processed fees/fines",
"type": "integer"
},
"errors": {
"description": "Contains array of errors",
"type": "array",
"items": {
"type": "string"
}
},
"metadata": {
"description": "Metadata about creation and changes, provided by the server (client should not provide)",
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "metadata.schema",
"title": "Metadata Schema",
"properties": {
"createdDate": {
"description": "Date and time when the record was created",
"type": "string",
"format": "date-time"
},
"createdByUserId": {
"description": "ID of the user who created the record (when available)",
"type": "string",
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"createdByUsername": {
"description": "Username of the user who created the record (when available)",
"type": "string"
},
"updatedDate": {
"description": "Date and time when the record was last updated",
"type": "string",
"format": "date-time"
},
"updatedByUserId": {
"description": "ID of the user who last updated the record (when available)",
"type": "string",
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"updatedByUsername": {
"description": "Username of the user who last updated the record (when available)",
"type": "string"
}
},
"additionalProperties": false,
"required": [
"createdDate"
]
}
},
"additionalProperties": false,
"required": [
"scope"
]
}HTTP status code 201
Synchronization was done successfully
Body
Media type: application/json
Type: json
Content:
{
"$schema": "http://json-schema.org/draft-04/schema#",
"type": "object",
"description": "Synchronization job schema",
"properties": {
"id": {
"description": "Synchronization job ID",
"type": "string",
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "uuid.schema",
"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}$"
},
"scope": {
"type": "string",
"description": "Scope of re-sync data",
"enum": [
"user",
"full"
]
},
"userId": {
"type": "string",
"description": "Users ID for if scope is [user]",
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "uuid.schema",
"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}$"
},
"status": {
"description": "Status of synchronization job",
"type": "string"
},
"totalNumberOfLoans": {
"description": "Total number of loans",
"type": "integer"
},
"totalNumberOfFeesFines": {
"description": "Total number of fees/fines",
"type": "integer"
},
"numberOfProcessedLoans": {
"description": "Total number of processed loans",
"type": "integer"
},
"numberOfProcessedFeesFines": {
"description": "Total number of processed fees/fines",
"type": "integer"
},
"errors": {
"description": "Contains array of errors",
"type": "array",
"items": {
"type": "string"
}
},
"metadata": {
"description": "Metadata about creation and changes, provided by the server (client should not provide)",
"type": "object",
"$schema": "http://json-schema.org/draft-04/schema#",
"id": "metadata.schema",
"title": "Metadata Schema",
"properties": {
"createdDate": {
"description": "Date and time when the record was created",
"type": "string",
"format": "date-time"
},
"createdByUserId": {
"description": "ID of the user who created the record (when available)",
"type": "string",
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"createdByUsername": {
"description": "Username of the user who created the record (when available)",
"type": "string"
},
"updatedDate": {
"description": "Date and time when the record was last updated",
"type": "string",
"format": "date-time"
},
"updatedByUserId": {
"description": "ID of the user who last updated the record (when available)",
"type": "string",
"pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$"
},
"updatedByUsername": {
"description": "Username of the user who last updated the record (when available)",
"type": "string"
}
},
"additionalProperties": false,
"required": [
"createdDate"
]
}
},
"additionalProperties": false,
"required": [
"scope"
]
}Example:
{
"id": "a28dc77a-995b-43d4-9af8-a7b345a13bce",
"scope": "user",
"userId": "92a16061-77e8-48d0-8434-717c17258f2c",
"status": "in-progress",
"totalNumberOfLoans": 10,
"totalNumberOfFeesFines": 10,
"numberOfProcessedLoans": 5,
"numberOfProcessedFeesFines": 5
}
HTTP status code 422
Job request is not valid
Body
Media type: text/plain
Type: any
Example:
The job is not validMedia 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"
}
]
}
]
}
HTTP status code 500
Internal server error
Body
Media type: text/plain
Type: any
Example:
Internal server error, please contact administratorChecks synchronization status of job
get /automated-patron-blocks/synchronization/job/{syncJobId}
Checks synchronization status of job
URI Parameters
- syncJobId: required(string)
HTTP status code 200
Body
Media type: application/json
Example:
{
"id": "a28dc77a-995b-43d4-9af8-a7b345a13bce",
"scope": "user",
"userId": "92a16061-77e8-48d0-8434-717c17258f2c",
"status": "in-progress",
"totalNumberOfLoans": 10,
"totalNumberOfFeesFines": 10,
"numberOfProcessedLoans": 5,
"numberOfProcessedFeesFines": 5
}
HTTP status code 404
The job was not found
Body
Media type: text/plain
Type: any
Example:
Bad request, e.g. invalid user UUIDHTTP status code 500
Internal server error, e.g. due to misconfiguration
Body
Media type: text/plain
Type: any
Example:
Internal server error, contact administrator