Finance - finance data (v1)

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

Table of contents

Finance data APIs

This documents the API calls that can be made to manage finance data

/finance/finance-data

Entity representing a finance-datum

GET /finance/finance-data

Get finance data

GET /finance/finance-data
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 fiscalYearId

    Example:

    (username=="ab*" or personal.firstName=="ab*" or personal.lastName=="ab*") and active=="true" sortby personal.lastName personal.firstName barcode
    
    ["fiscalYearId", "7a4c4d30-3b63-4102-8e2d-3ee5792d7d02", "="]
    
  • totalRecords: (string - default: auto - pattern: exact|estimated|none|auto)

    How to calculate the totalRecords property. "exact" for the correct number, "estimated" for an estimation, "auto" to automatically select "exact" or "estimated", "none" for suppressing the totalRecords property. For details see https://github.com/folio-org/raml-module-builder#estimated-totalrecords

    Example:

    none
  • 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. Using limit=0 will return totalRecords with the exact value. For details about totalRecords see https://github.com/folio-org/raml-module-builder#estimated-totalrecords

    Example:

    10

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 collection of fiscal year finance data",
  "type": "object",
  "properties": {
    "fyFinanceData": {
      "description": "The list of fiscal year finance data objects contained in this collection",
      "type": "array",
      "id": "fyFinanceData",
      "items": {
        "type": "object",
        "$schema": "http://json-schema.org/draft-04/schema#",
        "description": "Finance data for a fiscal year",
        "javaName": "FyFinanceData",
        "properties": {
          "fiscalYearId": {
            "description": "UUID of the fiscal year",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "type": "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}$"
          },
          "fiscalYearCode": {
            "description": "The code of the fiscal year",
            "type": "string"
          },
          "fundId": {
            "description": "Fund UUID",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "type": "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}$"
          },
          "fundCode": {
            "description": "A unique code associated with the fund",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "type": "string",
            "pattern": "^[^:]+$"
          },
          "fundName": {
            "description": "The name of this fund",
            "type": "string"
          },
          "fundDescription": {
            "description": "A description of this fund",
            "type": "string"
          },
          "fundStatus": {
            "description": "The current status of this fund",
            "type": "string"
          },
          "fundTags": {
            "type": "object",
            "description": "Arbitrary tags associated with this fund",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "id": "tags.schema",
            "title": "tags",
            "properties": {
              "tagList": {
                "description": "List of tags",
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "additionalProperties": false
          },
          "fundAcqUnitIds": {
            "description": "List of acquisition unit IDs associated with the fund",
            "type": "array",
            "items": {
              "$schema": "http://json-schema.org/draft-04/schema#",
              "description": "The UUID format string",
              "type": "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}$"
            }
          },
          "ledgerId": {
            "$schema": "http://json-schema.org/draft-04/schema#",
            "description": "The UUID format string",
            "type": "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}$"
          },
          "ledgerCode": {
            "description": "The code for the ledger",
            "type": "string"
          },
          "budgetId": {
            "description": "UUID of this budget",
            "type": "string"
          },
          "budgetName": {
            "description": "The name of the budget",
            "type": "string"
          },
          "budgetStatus": {
            "description": "The status of the budget",
            "type": "string"
          },
          "budgetInitialAllocation": {
            "description": "The amount of the first allocation made to this budget",
            "type": "number"
          },
          "budgetCurrentAllocation": {
            "description": "The amount currently allocated to this budget",
            "type": "number"
          },
          "budgetAllocationChange": {
            "description": "The change in allocation amount for this budget",
            "type": "number"
          },
          "budgetAllowableExpenditure": {
            "description": "The expenditure percentage limit for this budget",
            "type": "number"
          },
          "budgetAllowableEncumbrance": {
            "description": "The encumbrance percentage limit for this budget",
            "type": "number"
          },
          "budgetAfterAllocation": {
            "description": "The amount of the budget after the allocation",
            "type": "number"
          },
          "budgetAcqUnitIds": {
            "description": "List of acquisition unit IDs associated with the budget",
            "type": "array",
            "items": {
              "$schema": "http://json-schema.org/draft-04/schema#",
              "description": "The UUID format string",
              "type": "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}$"
            }
          },
          "groupId": {
            "$schema": "http://json-schema.org/draft-04/schema#",
            "description": "The UUID format string",
            "type": "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}$"
          },
          "groupCode": {
            "description": "The code for the group",
            "type": "string"
          },
          "transactionDescription": {
            "description": "A description of this transaction",
            "type": "string"
          },
          "transactionTag": {
            "type": "object",
            "description": "Arbitrary tags associated with this transaction",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "id": "tags.schema",
            "title": "tags",
            "properties": {
              "tagList": {
                "description": "List of tags",
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "additionalProperties": false
          },
          "isFundChanged": {
            "description": "Indicates if the fund has changed",
            "type": "boolean"
          },
          "isBudgetChanged": {
            "description": "Indicates if the budget has changed",
            "type": "boolean"
          }
        },
        "required": [
          "fiscalYearCode",
          "fiscalYearId",
          "fundId"
        ]
      }
    },
    "worksheetName": {
      "description": "The name of the worksheet from which the data was uploaded",
      "type": "string"
    },
    "updateType": {
      "description": "The type of update being performed",
      "type": "string",
      "enum": [
        "Preview",
        "Commit"
      ]
    },
    "totalRecords": {
      "description": "The number of objects contained in this collection",
      "type": "integer"
    }
  },
  "additionalProperties": false,
  "required": [
    "fyFinanceData",
    "updateType",
    "totalRecords"
  ]
}

Example:

{
  "fyFinanceData": [
    {
      "fiscalYearId": "123e4567-e89b-12d3-a456-426614174004",
      "fiscalYearCode": "FY2023",
      "fundId": "123e4567-e89b-12d3-a456-426614174000",
      "fundCode": "FND001",
      "fundName": "General Fund",
      "fundDescription": "This fund is used for general purposes.",
      "fundStatus": "Active",
      "fundTags": {
        "tagList": ["Education", "Research"]
      },
      "fundAcqUnitIds": ["123e4567-e89b-12d3-a456-426614174006"],
      "ledgerId": "123e4567-e89b-12d3-a456-426614174015",
      "ledgerCode": "LED001",
      "budgetId": "123e4567-e89b-12d3-a456-426614174001",
      "budgetName": "Annual Budget",
      "budgetStatus": "Active",
      "budgetInitialAllocation": 1000000,
      "budgetCurrentAllocation": 950000,
      "budgetAllowableExpenditure": 80,
      "budgetAllowableEncumbrance": 90,
      "budgetAcqUnitIds": ["123e4567-e89b-12d3-a456-426614174008"],
      "groupId": "123e4567-e89b-12d3-a456-426614174025",
      "groupCode": "GRP001",
      "isFundChanged": false,
      "isBudgetChanged": true
    },
    {
      "fiscalYearId": "123e4567-e89b-12d3-a456-426614174005",
      "fiscalYearCode": "FY2023",
      "fundId": "123e4567-e89b-12d3-a456-426614174002",
      "fundCode": "FND002",
      "fundName": "Research Fund",
      "fundDescription": "This fund is used for research purposes.",
      "fundStatus": "Frozen",
      "fundTags": {
        "tagList": ["Science", "Innovation"]
      },
      "fundAcqUnitIds": ["123e4567-e89b-12d3-a456-426614174007"],
      "ledgerId": "123e4567-e89b-12d3-a456-426614174016",
      "ledgerCode": "LED002",
      "budgetId": "123e4567-e89b-12d3-a456-426614174003",
      "budgetName": "Research Budget",
      "budgetStatus": "Planned",
      "budgetInitialAllocation": 500000,
      "budgetCurrentAllocation": 450000,
      "budgetAllowableExpenditure": 70,
      "budgetAllowableEncumbrance": 85,
      "budgetAcqUnitIds": ["123e4567-e89b-12d3-a456-426614174009"],
      "groupId": "123e4567-e89b-12d3-a456-426614174026",
      "groupCode": "GRP002",
      "isFundChanged": true,
      "isBudgetChanged": true
    }
  ],
  "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 finance-data -- 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 finance-data -- unauthorized"

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"finance-datum 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 /finance/finance-data

Update finance, budget as a bulk

PUT /finance/finance-data
Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A collection of fiscal year finance data",
  "type": "object",
  "properties": {
    "fyFinanceData": {
      "description": "The list of fiscal year finance data objects contained in this collection",
      "type": "array",
      "id": "fyFinanceData",
      "items": {
        "type": "object",
        "$schema": "http://json-schema.org/draft-04/schema#",
        "description": "Finance data for a fiscal year",
        "javaName": "FyFinanceData",
        "properties": {
          "fiscalYearId": {
            "description": "UUID of the fiscal year",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "type": "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}$"
          },
          "fiscalYearCode": {
            "description": "The code of the fiscal year",
            "type": "string"
          },
          "fundId": {
            "description": "Fund UUID",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "type": "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}$"
          },
          "fundCode": {
            "description": "A unique code associated with the fund",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "type": "string",
            "pattern": "^[^:]+$"
          },
          "fundName": {
            "description": "The name of this fund",
            "type": "string"
          },
          "fundDescription": {
            "description": "A description of this fund",
            "type": "string"
          },
          "fundStatus": {
            "description": "The current status of this fund",
            "type": "string"
          },
          "fundTags": {
            "type": "object",
            "description": "Arbitrary tags associated with this fund",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "id": "tags.schema",
            "title": "tags",
            "properties": {
              "tagList": {
                "description": "List of tags",
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "additionalProperties": false
          },
          "fundAcqUnitIds": {
            "description": "List of acquisition unit IDs associated with the fund",
            "type": "array",
            "items": {
              "$schema": "http://json-schema.org/draft-04/schema#",
              "description": "The UUID format string",
              "type": "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}$"
            }
          },
          "ledgerId": {
            "$schema": "http://json-schema.org/draft-04/schema#",
            "description": "The UUID format string",
            "type": "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}$"
          },
          "ledgerCode": {
            "description": "The code for the ledger",
            "type": "string"
          },
          "budgetId": {
            "description": "UUID of this budget",
            "type": "string"
          },
          "budgetName": {
            "description": "The name of the budget",
            "type": "string"
          },
          "budgetStatus": {
            "description": "The status of the budget",
            "type": "string"
          },
          "budgetInitialAllocation": {
            "description": "The amount of the first allocation made to this budget",
            "type": "number"
          },
          "budgetCurrentAllocation": {
            "description": "The amount currently allocated to this budget",
            "type": "number"
          },
          "budgetAllocationChange": {
            "description": "The change in allocation amount for this budget",
            "type": "number"
          },
          "budgetAllowableExpenditure": {
            "description": "The expenditure percentage limit for this budget",
            "type": "number"
          },
          "budgetAllowableEncumbrance": {
            "description": "The encumbrance percentage limit for this budget",
            "type": "number"
          },
          "budgetAfterAllocation": {
            "description": "The amount of the budget after the allocation",
            "type": "number"
          },
          "budgetAcqUnitIds": {
            "description": "List of acquisition unit IDs associated with the budget",
            "type": "array",
            "items": {
              "$schema": "http://json-schema.org/draft-04/schema#",
              "description": "The UUID format string",
              "type": "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}$"
            }
          },
          "groupId": {
            "$schema": "http://json-schema.org/draft-04/schema#",
            "description": "The UUID format string",
            "type": "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}$"
          },
          "groupCode": {
            "description": "The code for the group",
            "type": "string"
          },
          "transactionDescription": {
            "description": "A description of this transaction",
            "type": "string"
          },
          "transactionTag": {
            "type": "object",
            "description": "Arbitrary tags associated with this transaction",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "id": "tags.schema",
            "title": "tags",
            "properties": {
              "tagList": {
                "description": "List of tags",
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "additionalProperties": false
          },
          "isFundChanged": {
            "description": "Indicates if the fund has changed",
            "type": "boolean"
          },
          "isBudgetChanged": {
            "description": "Indicates if the budget has changed",
            "type": "boolean"
          }
        },
        "required": [
          "fiscalYearCode",
          "fiscalYearId",
          "fundId"
        ]
      }
    },
    "worksheetName": {
      "description": "The name of the worksheet from which the data was uploaded",
      "type": "string"
    },
    "updateType": {
      "description": "The type of update being performed",
      "type": "string",
      "enum": [
        "Preview",
        "Commit"
      ]
    },
    "totalRecords": {
      "description": "The number of objects contained in this collection",
      "type": "integer"
    }
  },
  "additionalProperties": false,
  "required": [
    "fyFinanceData",
    "updateType",
    "totalRecords"
  ]
}

Example:

{
  "fyFinanceData": [
    {
      "fiscalYearId": "123e4567-e89b-12d3-a456-426614174004",
      "fiscalYearCode": "FY2023",
      "fundId": "123e4567-e89b-12d3-a456-426614174000",
      "fundCode": "FND001",
      "fundName": "General Fund",
      "fundDescription": "This fund is used for general purposes.",
      "fundStatus": "Active",
      "fundTags": {
        "tagList": ["Education", "Research"]
      },
      "fundAcqUnitIds": ["123e4567-e89b-12d3-a456-426614174006"],
      "ledgerId": "123e4567-e89b-12d3-a456-426614174015",
      "ledgerCode": "LED001",
      "budgetId": "123e4567-e89b-12d3-a456-426614174001",
      "budgetName": "Annual Budget",
      "budgetStatus": "Active",
      "budgetInitialAllocation": 1000000,
      "budgetCurrentAllocation": 950000,
      "budgetAllocationChange": -50000,
      "budgetAllowableExpenditure": 80,
      "budgetAllowableEncumbrance": 90,
      "budgetAfterAllocation": 900000,
      "budgetAcqUnitIds": ["123e4567-e89b-12d3-a456-426614174008"],
      "groupId": "123e4567-e89b-12d3-a456-426614174025",
      "groupCode": "GRP001",
      "transactionDescription": "End of year adjustment",
      "transactionTag": {
        "tagList": ["Urgent", "Review"]
      }
    },
    {
      "fiscalYearId": "123e4567-e89b-12d3-a456-426614174005",
      "fiscalYearCode": "FY2023",
      "fundId": "123e4567-e89b-12d3-a456-426614174002",
      "fundCode": "FND002",
      "fundName": "Research Fund",
      "fundDescription": "This fund is used for research purposes.",
      "fundStatus": "Frozen",
      "fundTags": {
        "tagList": ["Science", "Innovation"]
      },
      "fundAcqUnitIds": ["123e4567-e89b-12d3-a456-426614174007"],
      "ledgerId": "123e4567-e89b-12d3-a456-426614174016",
      "ledgerCode": "LED002",
      "budgetId": "123e4567-e89b-12d3-a456-426614174003",
      "budgetName": "Research Budget",
      "budgetStatus": "Planned",
      "budgetInitialAllocation": 500000,
      "budgetCurrentAllocation": 450000,
      "budgetAllocationChange": -50000,
      "budgetAllowableExpenditure": 70,
      "budgetAllowableEncumbrance": 85,
      "budgetAfterAllocation": 400000,
      "budgetAcqUnitIds": ["123e4567-e89b-12d3-a456-426614174009"],
      "groupId": "123e4567-e89b-12d3-a456-426614174026",
      "groupCode": "GRP002",
      "transactionDescription": "Mid-year adjustment",
      "transactionTag": {
        "tagList": ["Urgent", "Review"]
      }
    }
  ],
  "worksheetName": "FY2023_Finance_Data",
  "updateType": "Commit",
  "totalRecords": 2
}

Response 204

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

Response 404

One or more items not found

Body

Media type: text/plain

Type: any

Example:

"One or more items not found"

Response 409

Optimistic locking version conflict

Body

Media type: text/plain

Type: any

Example:

version conflict

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

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

internal server error, contact administrator