mod-funds (v1)

https://github.com/folio-org/mod-funds

Table of contents

mod-funds (Budgets)

CRUD APIs used to manage encumbrances.

/encumbrance

Collection of encumbrance items.

GET /encumbrance

Get list of encumbrances

GET /encumbrance
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: e.g.

    Example:

    (username=="ab*" or personal.firstName=="ab*" or personal.lastName=="ab*") and active=="true" sortby personal.lastName personal.firstName barcode
    
    ["code", "MEDGRANT", "="]
    
  • 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
  • lang: (string - default: en - pattern: [a-zA-Z]{2})

    Requested language. Optional. [lang=en]

Response 200

Returns a list of encumbrance items

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A collection of encumbrances",
  "type": "object",
  "properties": {
    "encumbrances": {
      "description": "The list of encumbrance objects in this collection",
      "type": "array",
      "id": "encumbrances",
      "items": {
        "description": "The encumbrance items",
        "type": "object",
        "$ref": "encumbrance.json"
      }
    },
    "total_records": {
      "description": "The number of objects in this collection",
      "type": "integer"
    },
    "first": {
      "description": "The index of the first object in this collection",
      "type": "integer"
    },
    "last": {
      "description": "The index of the last object in this collection",
      "type": "integer"
    }
  },
  "additionalProperties": false,
  "required": [
    "encumbrances",
    "total_records"
  ]
}

Example:

{
  "encumbrances": [
    {
      "id": "47Ac60b4-159D-4e1c-9aCB-8293Df67D16d",
      "amount_encumbered": 12.50,
      "current_encumbered": 12.50,
      "amount_expended": 1567.92,
      "encumbrance_status": "unknown",
      "currency": "CAD",
      "exchange_rate": "1",
      "po_line_id": "47Ac60b4-159D-4e1c-9aCB-8293Df67D16d",
      "fund_id": "47Ac60b4-159D-4e1c-9aCB-8293Df67D16d"
    }
  ],
  "total_records": 1,
  "first": 1,
  "last": 1
}

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 encumbrance -- 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 encumbrance -- 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 /encumbrance

Create a new encumbrance item.

POST /encumbrance
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#",
  "description": "An encumbrance of fund resources",
  "type": "object",
  "properties": {
    "id": {
      "type": ["string", "null"],
      "description": "UUID",
      "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}$"
    },
    "amount_encumbered": {
      "description": "The amount of this encumbrance",
      "type": "number"
    },
    "current_encumbered": {
      "description": "The amount currently encumbered",
      "type": "number"
    },
    "amount_expended": {
      "description": "The amount currently expended by this encumbrance",
      "type": "number"
    },
    "encumbrance_status": {
      "description": "The status of this encumbrance",
      "type": "string"
    },
    "currency": {
      "description": "The currency type used by this encumbrance",
      "type": "string"
    },
    "exchange_rate": {
      "description": "The exchange rate used by this encumbrance",
      "type": "string"
    },
    "po_line_id": {
      "type": ["string", "null"],
      "description": "UUID",
      "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}$"
    },
    "fund_id": {
      "type": ["string", "null"],
      "description": "UUID",
      "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}$"
    }
  },
  "additionalProperties": false,
  "required": [
    "currency"
  ]
}

Example:

{
  "id": "47Ac60b4-159D-4e1c-9aCB-8293Df67D16d",
  "amount_encumbered": 12.50,
  "current_encumbered": 12.50,
  "amount_expended": 1567.92,
  "encumbrance_status": "unknown",
  "currency": "CAD",
  "exchange_rate": "1",
  "po_line_id": "47Ac60b4-159D-4e1c-9aCB-8293Df67D16d",
  "fund_id": "47Ac60b4-159D-4e1c-9aCB-8293Df67D16d"
}

Response 201

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

Headers
  • Location: required (string)

    URI to the created encumbrance item

Body

Media type: application/json

Type: any

Example:

{
  "id": "47Ac60b4-159D-4e1c-9aCB-8293Df67D16d",
  "amount_encumbered": 12.50,
  "current_encumbered": 12.50,
  "amount_expended": 1567.92,
  "encumbrance_status": "unknown",
  "currency": "CAD",
  "exchange_rate": "1",
  "po_line_id": "47Ac60b4-159D-4e1c-9aCB-8293Df67D16d",
  "fund_id": "47Ac60b4-159D-4e1c-9aCB-8293Df67D16d"
}

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

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Example:

unable to create encumbrance -- 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 /encumbrance/{id}

Retrieve encumbrance item with given {encumbranceId}

GET /encumbrance/{id}
URI Parameters
  • id: 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#",
  "description": "An encumbrance of fund resources",
  "type": "object",
  "properties": {
    "id": {
      "type": ["string", "null"],
      "description": "UUID",
      "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}$"
    },
    "amount_encumbered": {
      "description": "The amount of this encumbrance",
      "type": "number"
    },
    "current_encumbered": {
      "description": "The amount currently encumbered",
      "type": "number"
    },
    "amount_expended": {
      "description": "The amount currently expended by this encumbrance",
      "type": "number"
    },
    "encumbrance_status": {
      "description": "The status of this encumbrance",
      "type": "string"
    },
    "currency": {
      "description": "The currency type used by this encumbrance",
      "type": "string"
    },
    "exchange_rate": {
      "description": "The exchange rate used by this encumbrance",
      "type": "string"
    },
    "po_line_id": {
      "type": ["string", "null"],
      "description": "UUID",
      "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}$"
    },
    "fund_id": {
      "type": ["string", "null"],
      "description": "UUID",
      "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}$"
    }
  },
  "additionalProperties": false,
  "required": [
    "currency"
  ]
}

Example:

{
  "id": "47Ac60b4-159D-4e1c-9aCB-8293Df67D16d",
  "amount_encumbered": 12.50,
  "current_encumbered": 12.50,
  "amount_expended": 1567.92,
  "encumbrance_status": "unknown",
  "currency": "CAD",
  "exchange_rate": "1",
  "po_line_id": "47Ac60b4-159D-4e1c-9aCB-8293Df67D16d",
  "fund_id": "47Ac60b4-159D-4e1c-9aCB-8293Df67D16d"
}

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"encumbrance 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 /encumbrance/{id}

Delete encumbrance item with given {encumbranceId}

DELETE /encumbrance/{id}
URI Parameters
  • id: 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 encumbrance -- constraint violation"

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"encumbrance 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 /encumbrance/{id}

Update encumbrance item with given {encumbranceId}

PUT /encumbrance/{id}
URI Parameters
  • id: 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#",
  "description": "An encumbrance of fund resources",
  "type": "object",
  "properties": {
    "id": {
      "type": ["string", "null"],
      "description": "UUID",
      "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}$"
    },
    "amount_encumbered": {
      "description": "The amount of this encumbrance",
      "type": "number"
    },
    "current_encumbered": {
      "description": "The amount currently encumbered",
      "type": "number"
    },
    "amount_expended": {
      "description": "The amount currently expended by this encumbrance",
      "type": "number"
    },
    "encumbrance_status": {
      "description": "The status of this encumbrance",
      "type": "string"
    },
    "currency": {
      "description": "The currency type used by this encumbrance",
      "type": "string"
    },
    "exchange_rate": {
      "description": "The exchange rate used by this encumbrance",
      "type": "string"
    },
    "po_line_id": {
      "type": ["string", "null"],
      "description": "UUID",
      "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}$"
    },
    "fund_id": {
      "type": ["string", "null"],
      "description": "UUID",
      "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}$"
    }
  },
  "additionalProperties": false,
  "required": [
    "currency"
  ]
}

Example:

{
  "id": "47Ac60b4-159D-4e1c-9aCB-8293Df67D16d",
  "amount_encumbered": 12.50,
  "current_encumbered": 12.50,
  "amount_expended": 1567.92,
  "encumbrance_status": "unknown",
  "currency": "CAD",
  "exchange_rate": "1",
  "po_line_id": "47Ac60b4-159D-4e1c-9aCB-8293Df67D16d",
  "fund_id": "47Ac60b4-159D-4e1c-9aCB-8293Df67D16d"
}

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

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

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