Automated patron blocks (v0.1)

http://github.com/org/folio/mod-feesfines

Table of contents

API for checking if any automated patron blocks exist for patron

Automated patron blocks API

/automated-patron-blocks

GET /automated-patron-blocks/{userId}

GET /automated-patron-blocks/{userId}
URI Parameters
  • userId: required (string)

Response 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"
    }
  ]
}

Response 400

Invalid user ID in request

Body

Media type: text/plain

Type: any

Example:

Bad request, e.g. invalid user UUID

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

Internal server error, contact administrator

POST /automated-patron-blocks/synchronization/job

POST /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"
  ]
}

Response 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
}

Response 422

Job request is not valid

Body

Media type: text/plain

Type: any

Example:

The job is not valid

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, please contact administrator

GET /automated-patron-blocks/synchronization/job/{syncJobId}

Checks synchronization status of job

GET /automated-patron-blocks/synchronization/job/{syncJobId}
URI Parameters
  • syncJobId: required (string)

Response 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
}

Response 404

The job was not found

Body

Media type: text/plain

Type: any

Example:

Bad request, e.g. invalid user UUID

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

Internal server error, contact administrator

POST /automated-patron-blocks/synchronization/start

POST /automated-patron-blocks/synchronization/start

Response 202

Synchronization job has been accepted for processing

Response 500

Internal server error

Body

Media type: text/plain

Type: any

Example:

Internal server error, please contact administrator