Accounts (v1)

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

Table of contents

Accounts API

This documents the API calls that can be made to query and manage feefine of the system

/accounts

Collection of account items.

GET /accounts

Return a list of accounts

GET /accounts
Query Parameters
  • 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.

    with valid searchable fields

    Example:

    (username=="ab*" or personal.firstName=="ab*" or personal.lastName=="ab*") and active=="true" sortby personal.lastName personal.firstName barcode
    
    active=true
    
  • orderBy: (string)

    Order by field: field A, field B

  • order: (one of desc, asc - default: desc)

    Order

  • 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
  • facets: (array of string)

    facets to return in the collection result set, can be suffixed by a count of facet values to return, for example, patronGroup:10 default to top 5 facet values

  • lang: (string - default: en - pattern: [a-zA-Z]{2})

    Requested language. Optional. [lang=en]

Response 200

Returns a list of account items

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "properties": {
    "accounts": {
      "type": "array",
      "id": "accountsData",
      "items": {
        "type": "object",
        "$ref": "accountdata.json"
      }
    },
    "totalRecords": {
      "type": "integer"
    },
    "resultInfo":{
      "$ref": "raml-util/schemas/resultInfo.schema",
      "readonly":true
    }
  },
  "required": [
    "accounts",
    "totalRecords"
  ]
}

Example:

{
  "accounts" : [ {
    "amount": 15.0,
    "remaining": 15.0,
    "dateCreated": "2018-01-31T00:00:01Z",
    "dateUpdated": "2018-01-31T00:00:01Z",
    "status": {
      "name": "Open"
    },
    "paymentStatus": {
      "name": "Paid Partially"
    },
    "feeFineType": "Damaged Book Fee",
    "feeFineOwner": "Main Admin",
    "title": "Interesting Times",
    "callNumber": "D15.H63 A3 2002",
    "barcode": "326547658598",
    "materialType": "Book",
    "itemStatus": {
      "name": "Available"
    },
    "location": "Main Library",
    "metadata": {
      "createdByUserId": "1ad737b0-d847-11e6-bf26-cec0c932ce01",
      "createdDate": "2018-01-31T21:21:02Z"
    },
    "dueDate": "2017-01-19T12:42:21Z",
    "returnedDate": "2017-01-08T10:25:54Z",
    "loanId": "b74d7b62-0689-49d9-bd4c-38b44d17a250",
    "userId": "77477611-ab44-4082-a0d8-42f7acdfde11",
    "itemId": "bb5a6689-c008-4c96-8f8f-b666850ee12d",
    "materialTypeId": "1a54b431-2e4f-452d-9cae-9cee66c9a892",
    "feeFineId": "57dbeeba-f26b-4dc0-abc8-21cce7659834",
    "ownerId": "3c7b8695-b537-40b1-b0a3-948ad7e1fc09",
    "id": "0bab56e5-1ab6-4ac2-afdf-8b2df0434379"
  }, {
    "amount": 5.0,
    "remaining": 5.0,
    "dateCreated": "2018-01-31T00:00:01Z",
    "dateUpdated": "2018-01-31T00:00:01Z",
    "status": {
      "name": "Closed"
    },
    "paymentStatus": {
      "name": "Waived Partially"
    },
    "feeFineType": "Late",
    "feeFineOwner": "Main Library Administration Office",
    "title": "Bridget Jones's Baby: the diaries",
    "callNumber": "PR6056.I4588 B749 2016",
    "barcode": "453987605438",
    "materialType": "Book",
    "itemStatus": {
      "name": "Checked out"
    },
    "location": "Main Library",
    "metadata": {
    "createdByUserId": "1ad737b0-d847-11e6-bf26-cec0c932ce01",
    "createdDate": "2018-01-31T21:21:02Z"
    },
    "dueDate": "2017-01-19T12:42:21Z",
    "returnedDate": "2017-01-08T10:25:54Z",
    "loanId": "0bab56e5-1ab6-4ac2-afdf-8b2df0434378",
    "userId": "fc45c606-410d-4a7c-9f95-1a3fea2eef42",
    "itemId": "4428a37c-8bae-4f0d-865d-970d83d5ad55",
    "materialTypeId": "1a54b431-2e4f-452d-9cae-9cee66c9a892",
    "feeFineId": "7a29a689-32fe-41fd-a8b4-db21b75bd621",
    "ownerId": "3c7b8695-b537-40b1-b0a3-948ad7e1fc09",
    "id": "0bab56e5-1ab6-4ac2-afdf-8b2df0434379"
  } ],
  "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 accounts -- 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 accounts -- unauthorized

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

internal server error, contact administrator

POST /accounts

Create a account

POST /accounts
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#",
  "title": "Accounts Schema",
  "type": "object",
  "properties": {
    "amount": {
      "type": "number"
    },
    "remaining": {
      "type": "number"
    },
    "dateCreated": {
      "type": "string",
      "format": "date-time"
    },
    "dateUpdated": {
      "type": "string",
      "format": "date-time"
    },
    "status": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        }
      },
      "required": [
        "name"
      ]
    },
    "paymentStatus": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        }
      },
      "required": [
        "name"
      ]
    },
    "feeFineType": {
      "type": "string"
    },
    "feeFineOwner": {
      "type": "string"
    },
    "title": {
      "type": "string"
    },
    "callNumber": {
      "type": "string"
    },
    "barcode": {
      "type": "string"
    },
    "materialType": {
      "type": "string"
    },
    "itemStatus": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        }
      },
      "required": [
        "name"
      ]
    },
    "location": {
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "$ref" : "raml-util/schemas/metadata.schema"
    },
    "dueDate": {
      "type": "string",
      "format": "date-time"
    },
    "returnedDate": {
      "type": "string",
      "format": "date-time"
    },
    "loanId": {
      "type": "string"
    },
    "userId": {
      "type": "string"
    },
    "itemId": {
      "type": "string"
    },
    "materialTypeId": {
      "type": "string"
    },
    "feeFineId": {
      "type": "string"
    },
    "ownerId": {
      "type": "string"
    },
    "id": {
      "type": "string"
    }
  },
  "additionalProperties": false,
  "required": [
    "userId",
    "itemId",
    "materialTypeId",
    "feeFineId",
    "ownerId",
    "id"
   ]
}

Example:

{
  "amount": 15.0,
  "remaining": 15.0,
  "dateCreated": "2018-01-31T00:00:01Z",
  "dateUpdated": "2018-01-31T00:00:01Z",
  "status": {
    "name": "Open"
  },
  "paymentStatus": {
    "name": "Paid Partially"
  },
  "feeFineType": "Damaged Book Fee",
  "feeFineOwner": "Main Admin",
  "title": "Interesting Times",
  "callNumber": "D15.H63 A3 2002",
  "barcode": "326547658598",
  "materialType": "Book",
  "itemStatus": {
    "name": "Available"
  },
  "location": "Main Library",
  "metadata": {
    "createdByUserId": "1ad737b0-d847-11e6-bf26-cec0c932ce01",
    "createdDate": "2018-01-31T21:21:02Z"
  },
  "dueDate": "2017-01-19T12:42:21Z",
  "returnedDate": "2017-01-08T10:25:54Z",
  "loanId": "b74d7b62-0689-49d9-bd4c-38b44d17a250",
  "userId": "77477611-ab44-4082-a0d8-42f7acdfde11",
  "itemId": "bb5a6689-c008-4c96-8f8f-b666850ee12d",
  "materialTypeId": "1a54b431-2e4f-452d-9cae-9cee66c9a892",
  "feeFineId": "57dbeeba-f26b-4dc0-abc8-21cce7659834",
  "ownerId": "3c7b8695-b537-40b1-b0a3-948ad7e1fc09",
  "id": "0bab56e5-1ab6-4ac2-afdf-8b2df0434379"
}

Response 201

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

Headers
  • Location: required (string)

    URI to the created account item

Body

Media type: application/json

Type: any

Example:

{
  "amount": 15.0,
  "remaining": 15.0,
  "dateCreated": "2018-01-31T00:00:01Z",
  "dateUpdated": "2018-01-31T00:00:01Z",
  "status": {
    "name": "Open"
  },
  "paymentStatus": {
    "name": "Paid Partially"
  },
  "feeFineType": "Damaged Book Fee",
  "feeFineOwner": "Main Admin",
  "title": "Interesting Times",
  "callNumber": "D15.H63 A3 2002",
  "barcode": "326547658598",
  "materialType": "Book",
  "itemStatus": {
    "name": "Available"
  },
  "location": "Main Library",
  "metadata": {
    "createdByUserId": "1ad737b0-d847-11e6-bf26-cec0c932ce01",
    "createdDate": "2018-01-31T21:21:02Z"
  },
  "dueDate": "2017-01-19T12:42:21Z",
  "returnedDate": "2017-01-08T10:25:54Z",
  "loanId": "b74d7b62-0689-49d9-bd4c-38b44d17a250",
  "userId": "77477611-ab44-4082-a0d8-42f7acdfde11",
  "itemId": "bb5a6689-c008-4c96-8f8f-b666850ee12d",
  "materialTypeId": "1a54b431-2e4f-452d-9cae-9cee66c9a892",
  "feeFineId": "57dbeeba-f26b-4dc0-abc8-21cce7659834",
  "ownerId": "3c7b8695-b537-40b1-b0a3-948ad7e1fc09",
  "id": "0bab56e5-1ab6-4ac2-afdf-8b2df0434379"
}

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 account -- malformed JSON at 13:3"

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Example:

unable to create accounts -- unauthorized

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

Internal server error, contact administrator

GET /accounts/{accountId}

Get a single account

GET /accounts/{accountId}
URI Parameters
  • accountId: 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#",
  "title": "Accounts Schema",
  "type": "object",
  "properties": {
    "amount": {
      "type": "number"
    },
    "remaining": {
      "type": "number"
    },
    "dateCreated": {
      "type": "string",
      "format": "date-time"
    },
    "dateUpdated": {
      "type": "string",
      "format": "date-time"
    },
    "status": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        }
      },
      "required": [
        "name"
      ]
    },
    "paymentStatus": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        }
      },
      "required": [
        "name"
      ]
    },
    "feeFineType": {
      "type": "string"
    },
    "feeFineOwner": {
      "type": "string"
    },
    "title": {
      "type": "string"
    },
    "callNumber": {
      "type": "string"
    },
    "barcode": {
      "type": "string"
    },
    "materialType": {
      "type": "string"
    },
    "itemStatus": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        }
      },
      "required": [
        "name"
      ]
    },
    "location": {
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "$ref" : "raml-util/schemas/metadata.schema"
    },
    "dueDate": {
      "type": "string",
      "format": "date-time"
    },
    "returnedDate": {
      "type": "string",
      "format": "date-time"
    },
    "loanId": {
      "type": "string"
    },
    "userId": {
      "type": "string"
    },
    "itemId": {
      "type": "string"
    },
    "materialTypeId": {
      "type": "string"
    },
    "feeFineId": {
      "type": "string"
    },
    "ownerId": {
      "type": "string"
    },
    "id": {
      "type": "string"
    }
  },
  "additionalProperties": false,
  "required": [
    "userId",
    "itemId",
    "materialTypeId",
    "feeFineId",
    "ownerId",
    "id"
   ]
}

Example:

{
  "amount": 15.0,
  "remaining": 15.0,
  "dateCreated": "2018-01-31T00:00:01Z",
  "dateUpdated": "2018-01-31T00:00:01Z",
  "status": {
    "name": "Open"
  },
  "paymentStatus": {
    "name": "Paid Partially"
  },
  "feeFineType": "Damaged Book Fee",
  "feeFineOwner": "Main Admin",
  "title": "Interesting Times",
  "callNumber": "D15.H63 A3 2002",
  "barcode": "326547658598",
  "materialType": "Book",
  "itemStatus": {
    "name": "Available"
  },
  "location": "Main Library",
  "metadata": {
    "createdByUserId": "1ad737b0-d847-11e6-bf26-cec0c932ce01",
    "createdDate": "2018-01-31T21:21:02Z"
  },
  "dueDate": "2017-01-19T12:42:21Z",
  "returnedDate": "2017-01-08T10:25:54Z",
  "loanId": "b74d7b62-0689-49d9-bd4c-38b44d17a250",
  "userId": "77477611-ab44-4082-a0d8-42f7acdfde11",
  "itemId": "bb5a6689-c008-4c96-8f8f-b666850ee12d",
  "materialTypeId": "1a54b431-2e4f-452d-9cae-9cee66c9a892",
  "feeFineId": "57dbeeba-f26b-4dc0-abc8-21cce7659834",
  "ownerId": "3c7b8695-b537-40b1-b0a3-948ad7e1fc09",
  "id": "0bab56e5-1ab6-4ac2-afdf-8b2df0434379"
}

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"account 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

DELETE /accounts/{accountId}

Delete account item with given {accountId}

DELETE /accounts/{accountId}
URI Parameters
  • accountId: 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 account -- constraint violation"

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"account 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

PUT /accounts/{accountId}

Update account item with given {accountId}

PUT /accounts/{accountId}
URI Parameters
  • accountId: 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#",
  "title": "Accounts Schema",
  "type": "object",
  "properties": {
    "amount": {
      "type": "number"
    },
    "remaining": {
      "type": "number"
    },
    "dateCreated": {
      "type": "string",
      "format": "date-time"
    },
    "dateUpdated": {
      "type": "string",
      "format": "date-time"
    },
    "status": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        }
      },
      "required": [
        "name"
      ]
    },
    "paymentStatus": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        }
      },
      "required": [
        "name"
      ]
    },
    "feeFineType": {
      "type": "string"
    },
    "feeFineOwner": {
      "type": "string"
    },
    "title": {
      "type": "string"
    },
    "callNumber": {
      "type": "string"
    },
    "barcode": {
      "type": "string"
    },
    "materialType": {
      "type": "string"
    },
    "itemStatus": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        }
      },
      "required": [
        "name"
      ]
    },
    "location": {
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "$ref" : "raml-util/schemas/metadata.schema"
    },
    "dueDate": {
      "type": "string",
      "format": "date-time"
    },
    "returnedDate": {
      "type": "string",
      "format": "date-time"
    },
    "loanId": {
      "type": "string"
    },
    "userId": {
      "type": "string"
    },
    "itemId": {
      "type": "string"
    },
    "materialTypeId": {
      "type": "string"
    },
    "feeFineId": {
      "type": "string"
    },
    "ownerId": {
      "type": "string"
    },
    "id": {
      "type": "string"
    }
  },
  "additionalProperties": false,
  "required": [
    "userId",
    "itemId",
    "materialTypeId",
    "feeFineId",
    "ownerId",
    "id"
   ]
}

Example:

{
  "amount": 15.0,
  "remaining": 15.0,
  "dateCreated": "2018-01-31T00:00:01Z",
  "dateUpdated": "2018-01-31T00:00:01Z",
  "status": {
    "name": "Open"
  },
  "paymentStatus": {
    "name": "Paid Partially"
  },
  "feeFineType": "Damaged Book Fee",
  "feeFineOwner": "Main Admin",
  "title": "Interesting Times",
  "callNumber": "D15.H63 A3 2002",
  "barcode": "326547658598",
  "materialType": "Book",
  "itemStatus": {
    "name": "Available"
  },
  "location": "Main Library",
  "metadata": {
    "createdByUserId": "1ad737b0-d847-11e6-bf26-cec0c932ce01",
    "createdDate": "2018-01-31T21:21:02Z"
  },
  "dueDate": "2017-01-19T12:42:21Z",
  "returnedDate": "2017-01-08T10:25:54Z",
  "loanId": "b74d7b62-0689-49d9-bd4c-38b44d17a250",
  "userId": "77477611-ab44-4082-a0d8-42f7acdfde11",
  "itemId": "bb5a6689-c008-4c96-8f8f-b666850ee12d",
  "materialTypeId": "1a54b431-2e4f-452d-9cae-9cee66c9a892",
  "feeFineId": "57dbeeba-f26b-4dc0-abc8-21cce7659834",
  "ownerId": "3c7b8695-b537-40b1-b0a3-948ad7e1fc09",
  "id": "0bab56e5-1ab6-4ac2-afdf-8b2df0434379"
}

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 account -- malformed JSON at 13:4"

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"account 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