foliolib.folio.api.finance.Budgets
- class foliolib.folio.api.finance.Budgets(tenant: str, okapi: Optional[foliolib.okapi.okapiClient.OkapiClient] = None)
Bases:
foliolib.folio.FolioApiBudget API
This documents the API calls that can be made to manage budgets
- Parameters
tenant (str) – Tenant id
okapi (OkapiClient, optional) – Instance of OkapiClient. Defaults to None.
Methods
delete_budget(budgetsId)Delete budget item with given {budgetId}
get_budget(budgetsId)Retrieve budget item with given {budgetId}
get_budgets(**kwargs)Retrieve a list of budget items.
get_expenseClassesTotals(budgetsId)Retrieve expenseClassesTotal item with given {expenseClassesTotalId}
modify_budget(budgetsId, budget)Update budget item with given {budgetId}
set_budget(budget)Create a new budget item.
- delete_budget(budgetsId: str)
Delete budget item with given {budgetId}
DELETE /finance/budgets/{budgetsId}- Parameters
budgetsId (str) –
- Raises
OkapiRequestNotFound – Not Found
OkapiRequestError – Bad Request
OkapiFatalError – Server Error
- get_budget(budgetsId: str)
Retrieve budget item with given {budgetId}
GET /finance/budgets/{budgetsId}- Parameters
budgetsId (str) –
- Returns
See Schema below
- Return type
dict
- Raises
OkapiRequestNotFound – Not Found
OkapiFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "A budget", "type": "object", "properties": { "id": { "description": "UUID of this budget", "$ref": "../../common/schemas/uuid.json" }, "_version": { "type": "integer", "description": "Record version for optimistic locking" }, "name": { "description": "The name of the budget", "type": "string" }, "budgetStatus": { "description": "The status of the budget", "type": "string", "enum": [ "Active", "Frozen", "Inactive", "Planned", "Closed" ] }, "allowableEncumbrance": { "description": "The encumbrance percentage limit for this budget", "type": "number" }, "allowableExpenditure": { "description": "The expenditure percentage limit for this budget", "type": "number" }, "allocated": { "description": "The amount currently allocated to this budget", "type": "number" }, "awaitingPayment": { "default": 0, "description": "The amount currently awaiting payment for this budget", "type": "number" }, "available": { "description": "The amount currently available for this budge", "type": "number", "readonly": true }, "encumbered": { "default": 0, "description": "The amount currently encumbered for this budget", "type": "number" }, "expenditures": { "default": 0, "description": "The amount currently expended for this budget", "type": "number" }, "netTransfers": { "default": 0, "description": "Summing all the transfers on this budget", "type": "number" }, "unavailable": { "description": "Unavailable amount for this budget", "type": "number", "readonly": true }, "overEncumbrance": { "description": "The amount currently over-encumbered for this budget", "type": "number", "readonly": true }, "overExpended": { "description": "Amount the budget is over expended.", "type": "number", "readonly": true }, "fundId": { "description": "UUID of fund", "$ref": "../../common/schemas/uuid.json" }, "fiscalYearId": { "description": "UUID of fiscal year", "$ref": "../../common/schemas/uuid.json" }, "acqUnitIds": { "description": "acquisition unit ids associated with this budget", "type": "array", "items": { "$ref": "../../common/schemas/uuid.json" } }, "tags": { "type": "object", "description": "arbitrary tags associated with this budget", "$ref": "../../../raml-util/schemas/tags.schema" }, "metadata": { "type": "object", "$ref": "../../../raml-util/schemas/metadata.schema", "readonly": true }, "initialAllocation": { "description": "The amount of the first allocation made to this budget", "type": "number", "readonly": true }, "allocationTo": { "description": "The sum of all allocation transaction amounts made TO this budget not including the Initial allocation", "type": "number", "readonly": true }, "allocationFrom": { "description": "The sum of all allocation transaction amounts made FROM this budget not including the Initial allocation", "type": "number", "readonly": true }, "totalFunding": { "description": "budget.allocated + budget.netTransfers", "type": "number", "readonly": true }, "cashBalance": { "description": "Total Funding minus Expended", "type": "number", "readonly": true }, "statusExpenseClasses": { "description": "Expense classes associated with this budget", "type": "array", "items": { "description": "Expense classes associated with this budget", "type": "object", "$ref": "status_expense_class.json" } } }, "additionalProperties": false, "required": [ "allocated" ] }
- get_budgets(**kwargs)
Retrieve a list of budget items.
GET /finance/budgets- Parameters
**kwargs (properties) – Keyword Arguments
- Keyword Arguments
totalRecords (str) –
(default=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 (int) –
(default=0) Skip over a number of elements by specifying an offset value for the query
Example
0
limit (int) –
(default=10) Limit the number of elements returned in the response
Example
10
query (str) –
A query expressed as a CQL string (see [dev.folio.org/reference/glossary#cql](https://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
[“name”, “HIST-FY19”, “=”]
- Returns
See Schema below
- Return type
dict
- Raises
OkapiRequestError – Bad Request
OkapiRequestUnauthorized – Authentication is required
OkapiFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "A collection of budgets", "type": "object", "properties": { "budgets": { "description": "The list of budget objects contained in this collection", "type": "array", "id": "budgets", "items": { "type": "object", "$ref": "budget.json" } }, "totalRecords": { "description": "The number of objects contained in this collection", "type": "integer" } }, "additionalProperties": false, "required": [ "budgets", "totalRecords" ] }
- get_expenseClassesTotals(budgetsId: str)
Retrieve expenseClassesTotal item with given {expenseClassesTotalId}
GET /finance/budgets/{budgetsId}/expense-classes-totals- Parameters
budgetsId (str) –
- Returns
See Schema below
- Return type
dict
- Raises
OkapiRequestError – Bad Request
OkapiRequestUnauthorized – Authentication is required
OkapiRequestNotFound – Not Found
OkapiFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "A collection of budget expense class total records", "type": "object", "properties": { "budgetExpenseClassTotals": { "description": "The list of budget expense class total objects contained in this collection", "type": "array", "items": { "type": "object", "$ref": "budget_expense_class_totals.json" } }, "totalRecords": { "description": "The number of objects contained in this collection", "type": "integer" } }, "additionalProperties": false, "required": [ "budgetExpenseClassTotals", "totalRecords" ] }
- modify_budget(budgetsId: str, budget: dict)
Update budget item with given {budgetId}
PUT /finance/budgets/{budgetsId}- Parameters
budgetsId (str) –
budget (dict) – See Schema below
- Raises
OkapiRequestNotFound – Not Found
OkapiRequestError – Bad Request
OkapiRequestConflict – Conflict
OkapiFatalError – Server Error
OkapiRequestUnprocessableEntity – Unprocessable Entity
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "A budget", "type": "object", "properties": { "id": { "description": "UUID of this budget", "$ref": "../../common/schemas/uuid.json" }, "_version": { "type": "integer", "description": "Record version for optimistic locking" }, "name": { "description": "The name of the budget", "type": "string" }, "budgetStatus": { "description": "The status of the budget", "type": "string", "enum": [ "Active", "Frozen", "Inactive", "Planned", "Closed" ] }, "allowableEncumbrance": { "description": "The encumbrance percentage limit for this budget", "type": "number" }, "allowableExpenditure": { "description": "The expenditure percentage limit for this budget", "type": "number" }, "allocated": { "description": "The amount currently allocated to this budget", "type": "number" }, "awaitingPayment": { "default": 0, "description": "The amount currently awaiting payment for this budget", "type": "number" }, "available": { "description": "The amount currently available for this budge", "type": "number", "readonly": true }, "encumbered": { "default": 0, "description": "The amount currently encumbered for this budget", "type": "number" }, "expenditures": { "default": 0, "description": "The amount currently expended for this budget", "type": "number" }, "netTransfers": { "default": 0, "description": "Summing all the transfers on this budget", "type": "number" }, "unavailable": { "description": "Unavailable amount for this budget", "type": "number", "readonly": true }, "overEncumbrance": { "description": "The amount currently over-encumbered for this budget", "type": "number", "readonly": true }, "overExpended": { "description": "Amount the budget is over expended.", "type": "number", "readonly": true }, "fundId": { "description": "UUID of fund", "$ref": "../../common/schemas/uuid.json" }, "fiscalYearId": { "description": "UUID of fiscal year", "$ref": "../../common/schemas/uuid.json" }, "acqUnitIds": { "description": "acquisition unit ids associated with this budget", "type": "array", "items": { "$ref": "../../common/schemas/uuid.json" } }, "tags": { "type": "object", "description": "arbitrary tags associated with this budget", "$ref": "../../../raml-util/schemas/tags.schema" }, "metadata": { "type": "object", "$ref": "../../../raml-util/schemas/metadata.schema", "readonly": true }, "initialAllocation": { "description": "The amount of the first allocation made to this budget", "type": "number", "readonly": true }, "allocationTo": { "description": "The sum of all allocation transaction amounts made TO this budget not including the Initial allocation", "type": "number", "readonly": true }, "allocationFrom": { "description": "The sum of all allocation transaction amounts made FROM this budget not including the Initial allocation", "type": "number", "readonly": true }, "totalFunding": { "description": "budget.allocated + budget.netTransfers", "type": "number", "readonly": true }, "cashBalance": { "description": "Total Funding minus Expended", "type": "number", "readonly": true }, "statusExpenseClasses": { "description": "Expense classes associated with this budget", "type": "array", "items": { "description": "Expense classes associated with this budget", "type": "object", "$ref": "status_expense_class.json" } } }, "additionalProperties": false, "required": [ "allocated" ] }
- set_budget(budget: dict)
Create a new budget item.
POST /finance/budgets- Parameters
budget (dict) – See Schema below
- Raises
OkapiRequestError – Bad Request
OkapiRequestUnauthorized – Authentication is required
OkapiFatalError – Server Error
OkapiRequestUnprocessableEntity – Unprocessable Entity
Headers
Location - URI to the created budget item
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "A budget", "type": "object", "properties": { "id": { "description": "UUID of this budget", "$ref": "../../common/schemas/uuid.json" }, "_version": { "type": "integer", "description": "Record version for optimistic locking" }, "name": { "description": "The name of the budget", "type": "string" }, "budgetStatus": { "description": "The status of the budget", "type": "string", "enum": [ "Active", "Frozen", "Inactive", "Planned", "Closed" ] }, "allowableEncumbrance": { "description": "The encumbrance percentage limit for this budget", "type": "number" }, "allowableExpenditure": { "description": "The expenditure percentage limit for this budget", "type": "number" }, "allocated": { "description": "The amount currently allocated to this budget", "type": "number" }, "awaitingPayment": { "default": 0, "description": "The amount currently awaiting payment for this budget", "type": "number" }, "available": { "description": "The amount currently available for this budge", "type": "number", "readonly": true }, "encumbered": { "default": 0, "description": "The amount currently encumbered for this budget", "type": "number" }, "expenditures": { "default": 0, "description": "The amount currently expended for this budget", "type": "number" }, "netTransfers": { "default": 0, "description": "Summing all the transfers on this budget", "type": "number" }, "unavailable": { "description": "Unavailable amount for this budget", "type": "number", "readonly": true }, "overEncumbrance": { "description": "The amount currently over-encumbered for this budget", "type": "number", "readonly": true }, "overExpended": { "description": "Amount the budget is over expended.", "type": "number", "readonly": true }, "fundId": { "description": "UUID of fund", "$ref": "../../common/schemas/uuid.json" }, "fiscalYearId": { "description": "UUID of fiscal year", "$ref": "../../common/schemas/uuid.json" }, "acqUnitIds": { "description": "acquisition unit ids associated with this budget", "type": "array", "items": { "$ref": "../../common/schemas/uuid.json" } }, "tags": { "type": "object", "description": "arbitrary tags associated with this budget", "$ref": "../../../raml-util/schemas/tags.schema" }, "metadata": { "type": "object", "$ref": "../../../raml-util/schemas/metadata.schema", "readonly": true }, "initialAllocation": { "description": "The amount of the first allocation made to this budget", "type": "number", "readonly": true }, "allocationTo": { "description": "The sum of all allocation transaction amounts made TO this budget not including the Initial allocation", "type": "number", "readonly": true }, "allocationFrom": { "description": "The sum of all allocation transaction amounts made FROM this budget not including the Initial allocation", "type": "number", "readonly": true }, "totalFunding": { "description": "budget.allocated + budget.netTransfers", "type": "number", "readonly": true }, "cashBalance": { "description": "Total Funding minus Expended", "type": "number", "readonly": true }, "statusExpenseClasses": { "description": "Expense classes associated with this budget", "type": "array", "items": { "description": "Expense classes associated with this budget", "type": "object", "$ref": "status_expense_class.json" } } }, "additionalProperties": false, "required": [ "allocated" ] }