mod-finance-storage (v2)

https://github.com/folio-org/mod-finance-storage

Table of contents

mod-finance-storage (Funds)

CRUD APIs used to manage funds.

/finance-storage/funds

Collection of fund items.

GET /finance-storage/funds

Get list of funds

GET /finance-storage/funds
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: for example code

    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 fund items

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A collection of funds",
  "type": "object",
  "properties": {
    "funds": {
      "description": "The list of funds contained in this collection",
      "type": "array",
      "id": "funds",
      "items": {
        "type": "object",
        "$ref": "fund.json"
      }
    },
    "totalRecords": {
      "description": "The number of objects contained in this collection",
      "type": "integer",
      "minimum": 0
    }
  },
  "additionalProperties": false,
  "required": [
    "funds",
    "totalRecords"
  ]
}

Example:

{
  "funds": [
    {
      "id": "20ad2b8d-84b0-4320-ad83-347c525dc8e1",
      "allocationFrom": [
        "b1f857ba-0e39-4c5b-851a-1b837a56b201",
        "1097980d-97c9-4130-b6f0-a11b7804887d"
      ],
      "allocationTo": [
        "24fa4a94-8aa2-4f69-abeb-f12b67f711e3"
      ],
      "code": "HIST",
      "description": "Tracking fund for the History department",
      "externalAccountNo": "52186156468152",
      "fundStatus": "Active",
      "ledgerId": "a3ec5552-c4a4-4a15-a57c-0046db536369",
      "name": "History",
      "tags": [
        "b708271c-b7f0-4c21-930b-2002d8d09f78"
      ],
      "metadata": {
        "createdDate": "2020-07-19T10:00:00.000+0000",
        "createdByUserId": "28d1057c-d137-11e8-a8d5-f2801f1b9fd1"
      }
    }
  ],
  "totalRecords": 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 funds -- 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 funds -- unauthorized

Response 422

Validation errors

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A set of errors",
  "type": "object",
  "properties": {
    "errors": {
      "description": "List of errors",
      "id": "errors",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "error.schema"
      }
    },
    "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, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

internal server error, contact administrator

POST /finance-storage/funds

Create a new fund item.

POST /finance-storage/funds
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": "A fund to track financial transactions",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of this fund",
      "type": "string",
      "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}$"
    },
    "allocationFrom": {
      "description": "All the funds that this fund is allowed to receive money from. This would be 1 fund or none. If this field is blank their is no restriction on allocating to this fund",
      "type": "array",
      "items": {
        "type": "string",
        "description": "UUID of the fund this fund is allowed to receive money from",
        "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}$"
      }
    },
    "allocationTo": {
      "description": "All the funds that this fund is allowed to send money to. This could be one or many.",
      "type": "array",
      "items": {
        "type": "string",
        "description": "UUID of the fund this fund is allowed to send money to",
        "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}$"
      }
    },
    "code": {
      "description": "A unique code associated with the fund",
      "type": "string"
    },
    "description": {
      "description": "The description of this fund",
      "type": "string"
    },
    "externalAccountNo": {
      "description": "Corresponding account in the financial system. Will be recorded in payment generated as well.",
      "type": "string"
    },
    "fundStatus": {
      "description": "The current status of this fund",
      "type": "string",
      "enum": [
        "Active",
        "Frozen",
        "Inactive"
      ]
    },
    "ledgerId": {
      "description": "UUID of the financial ledger associated with this fund",
      "type": "string",
      "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}$"
    },
    "name": {
      "description": "The name of this fund",
      "type": "string"
    },
    "tags": {
      "description": "The list of tags associated with this fund",
      "type": "array",
      "items": {
        "type": "string",
        "description": "UUID of tag",
        "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}$"
      }
    },
    "metadata": {
      "description": "Metadata about creation and changes to record, provided by the server (client should not provide)",
      "type": "object",
      "$ref": "../../../raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "externalAccountNo",
    "code",
    "fundStatus",
    "ledgerId",
    "name"
  ]
}

Example:

{
  "id": "6e2fbba3-d557-4480-bca3-b6f5c645de04",
  "allocationFrom": [
    "1a490199-833d-4876-b2ff-2bd61f8324f1",
    "d69a001c-ac69-4348-bee1-f9f3ef8a3f32"
  ],
  "allocationTo": [
    "c08a5b0c-6717-4788-9df5-b0e8338c1172"
  ],
  "code": "HIST",
  "description": "Tracking fund for the History department",
  "externalAccountNo": "1121112569489",
  "fundStatus": "Active",
  "ledgerId": "7ebd02c8-2bd4-40ae-b44d-0e76dc197633",
  "name": "History",
  "tags": [
    "67b2eaed-0702-4187-b761-fd473152bbc6"
  ],
  "metadata": {
    "createdDate": "2020-07-19T10:00:00.000+0000",
    "createdByUserId": "28d1057c-d137-11e8-a8d5-f2801f1b9fd1"
  }
}

Response 201

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

Headers
  • Location: required (string)

    URI to the created fund item

Body

Media type: application/json

Type: any

Example:

{
  "id": "6e2fbba3-d557-4480-bca3-b6f5c645de04",
  "allocationFrom": [
    "1a490199-833d-4876-b2ff-2bd61f8324f1",
    "d69a001c-ac69-4348-bee1-f9f3ef8a3f32"
  ],
  "allocationTo": [
    "c08a5b0c-6717-4788-9df5-b0e8338c1172"
  ],
  "code": "HIST",
  "description": "Tracking fund for the History department",
  "externalAccountNo": "1121112569489",
  "fundStatus": "Active",
  "ledgerId": "7ebd02c8-2bd4-40ae-b44d-0e76dc197633",
  "name": "History",
  "tags": [
    "67b2eaed-0702-4187-b761-fd473152bbc6"
  ],
  "metadata": {
    "createdDate": "2020-07-19T10:00:00.000+0000",
    "createdByUserId": "28d1057c-d137-11e8-a8d5-f2801f1b9fd1"
  }
}

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

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Example:

unable to create funds -- unauthorized

Response 422

Validation errors

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A set of errors",
  "type": "object",
  "properties": {
    "errors": {
      "description": "List of errors",
      "id": "errors",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "error.schema"
      }
    },
    "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, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

Internal server error, contact administrator

GET /finance-storage/funds/{id}

Retrieve fund item with given {fundId}

GET /finance-storage/funds/{id}
URI Parameters
  • id: required (string - pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$)

    The UUID of a fund

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": "A fund to track financial transactions",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of this fund",
      "type": "string",
      "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}$"
    },
    "allocationFrom": {
      "description": "All the funds that this fund is allowed to receive money from. This would be 1 fund or none. If this field is blank their is no restriction on allocating to this fund",
      "type": "array",
      "items": {
        "type": "string",
        "description": "UUID of the fund this fund is allowed to receive money from",
        "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}$"
      }
    },
    "allocationTo": {
      "description": "All the funds that this fund is allowed to send money to. This could be one or many.",
      "type": "array",
      "items": {
        "type": "string",
        "description": "UUID of the fund this fund is allowed to send money to",
        "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}$"
      }
    },
    "code": {
      "description": "A unique code associated with the fund",
      "type": "string"
    },
    "description": {
      "description": "The description of this fund",
      "type": "string"
    },
    "externalAccountNo": {
      "description": "Corresponding account in the financial system. Will be recorded in payment generated as well.",
      "type": "string"
    },
    "fundStatus": {
      "description": "The current status of this fund",
      "type": "string",
      "enum": [
        "Active",
        "Frozen",
        "Inactive"
      ]
    },
    "ledgerId": {
      "description": "UUID of the financial ledger associated with this fund",
      "type": "string",
      "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}$"
    },
    "name": {
      "description": "The name of this fund",
      "type": "string"
    },
    "tags": {
      "description": "The list of tags associated with this fund",
      "type": "array",
      "items": {
        "type": "string",
        "description": "UUID of tag",
        "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}$"
      }
    },
    "metadata": {
      "description": "Metadata about creation and changes to record, provided by the server (client should not provide)",
      "type": "object",
      "$ref": "../../../raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "externalAccountNo",
    "code",
    "fundStatus",
    "ledgerId",
    "name"
  ]
}

Example:

{
  "id": "6e2fbba3-d557-4480-bca3-b6f5c645de04",
  "allocationFrom": [
    "1a490199-833d-4876-b2ff-2bd61f8324f1",
    "d69a001c-ac69-4348-bee1-f9f3ef8a3f32"
  ],
  "allocationTo": [
    "c08a5b0c-6717-4788-9df5-b0e8338c1172"
  ],
  "code": "HIST",
  "description": "Tracking fund for the History department",
  "externalAccountNo": "1121112569489",
  "fundStatus": "Active",
  "ledgerId": "7ebd02c8-2bd4-40ae-b44d-0e76dc197633",
  "name": "History",
  "tags": [
    "67b2eaed-0702-4187-b761-fd473152bbc6"
  ],
  "metadata": {
    "createdDate": "2020-07-19T10:00:00.000+0000",
    "createdByUserId": "28d1057c-d137-11e8-a8d5-f2801f1b9fd1"
  }
}

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"fund not found"

Response 422

Validation errors

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A set of errors",
  "type": "object",
  "properties": {
    "errors": {
      "description": "List of errors",
      "id": "errors",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "error.schema"
      }
    },
    "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, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

internal server error, contact administrator

DELETE /finance-storage/funds/{id}

Delete fund item with given {fundId}

DELETE /finance-storage/funds/{id}
URI Parameters
  • id: required (string - pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$)

    The UUID of a fund

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 fund -- constraint violation"

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"fund not found"

Response 422

Validation errors

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A set of errors",
  "type": "object",
  "properties": {
    "errors": {
      "description": "List of errors",
      "id": "errors",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "error.schema"
      }
    },
    "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, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

Internal server error, contact administrator

PUT /finance-storage/funds/{id}

Update fund item with given {fundId}

PUT /finance-storage/funds/{id}
URI Parameters
  • id: required (string - pattern: ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$)

    The UUID of a fund

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": "A fund to track financial transactions",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of this fund",
      "type": "string",
      "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}$"
    },
    "allocationFrom": {
      "description": "All the funds that this fund is allowed to receive money from. This would be 1 fund or none. If this field is blank their is no restriction on allocating to this fund",
      "type": "array",
      "items": {
        "type": "string",
        "description": "UUID of the fund this fund is allowed to receive money from",
        "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}$"
      }
    },
    "allocationTo": {
      "description": "All the funds that this fund is allowed to send money to. This could be one or many.",
      "type": "array",
      "items": {
        "type": "string",
        "description": "UUID of the fund this fund is allowed to send money to",
        "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}$"
      }
    },
    "code": {
      "description": "A unique code associated with the fund",
      "type": "string"
    },
    "description": {
      "description": "The description of this fund",
      "type": "string"
    },
    "externalAccountNo": {
      "description": "Corresponding account in the financial system. Will be recorded in payment generated as well.",
      "type": "string"
    },
    "fundStatus": {
      "description": "The current status of this fund",
      "type": "string",
      "enum": [
        "Active",
        "Frozen",
        "Inactive"
      ]
    },
    "ledgerId": {
      "description": "UUID of the financial ledger associated with this fund",
      "type": "string",
      "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}$"
    },
    "name": {
      "description": "The name of this fund",
      "type": "string"
    },
    "tags": {
      "description": "The list of tags associated with this fund",
      "type": "array",
      "items": {
        "type": "string",
        "description": "UUID of tag",
        "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}$"
      }
    },
    "metadata": {
      "description": "Metadata about creation and changes to record, provided by the server (client should not provide)",
      "type": "object",
      "$ref": "../../../raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "externalAccountNo",
    "code",
    "fundStatus",
    "ledgerId",
    "name"
  ]
}

Example:

{
  "id": "6e2fbba3-d557-4480-bca3-b6f5c645de04",
  "allocationFrom": [
    "1a490199-833d-4876-b2ff-2bd61f8324f1",
    "d69a001c-ac69-4348-bee1-f9f3ef8a3f32"
  ],
  "allocationTo": [
    "c08a5b0c-6717-4788-9df5-b0e8338c1172"
  ],
  "code": "HIST",
  "description": "Tracking fund for the History department",
  "externalAccountNo": "1121112569489",
  "fundStatus": "Active",
  "ledgerId": "7ebd02c8-2bd4-40ae-b44d-0e76dc197633",
  "name": "History",
  "tags": [
    "67b2eaed-0702-4187-b761-fd473152bbc6"
  ],
  "metadata": {
    "createdDate": "2020-07-19T10:00:00.000+0000",
    "createdByUserId": "28d1057c-d137-11e8-a8d5-f2801f1b9fd1"
  }
}

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

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"fund not found"

Response 422

Validation errors

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A set of errors",
  "type": "object",
  "properties": {
    "errors": {
      "description": "List of errors",
      "id": "errors",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "error.schema"
      }
    },
    "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, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

internal server error, contact administrator