mod-funds (v1)

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

Table of contents

mod-funds

CRUD APIs used to manage funds.

/fund

Collection of fund items.

GET /fund

Get list of funds

GET /fund
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 funcds",
  "type": "object",
  "properties": {
    "funds": {
      "description": "The list of funds contained in this collection",
      "type": "array",
      "id": "funds",
      "items": {
        "type": "object",
        "$ref": "fund.json"
      }
    },
    "total_records": {
      "description": "The number of objects contained 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": [
    "funds",
    "total_records"
  ]
}

Example:

{
  "funds": [
    {
      "id": "172364c7-AaAa-A0C2-C12C-e35CeCcbfaF2",
      "name": "History",
      "code": "HIST",
      "created_date": "2775-01-01T13:06:34.186Z",
      "fund_status": "Active",
      "currency": "USD",
      "description": "Tracking fund for the History department",
      "ledger_id": "7cef8378-7CBd-BFaE-BCdd-8b9d7c0af9De",
      "allocation_from": [
        "45cf58eb-BbDf-C4c6-97e1-33C8F3ddEd65",
        "7e4112ec-89F0-08eD-1eD5-0bE3fD9FCcFF"
      ],
      "allocation_to": [
        "f8d4511a-f6B8-ccec-ad4c-FA5bEAbaD092"
      ],
      "tags": [
        "cb365b12-5eCB-6C13-9F45-f8eaEcb52c76"
      ]
    }

  ],
  "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 fund -- 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 fund -- 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 /fund

Create a new fund item.

POST /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": {
      "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}$"
    },
    "name": {
      "description": "The name of this fund",
      "type": "string"
    },
    "code": {
      "description": "The numeric code for this fund",
      "type": "string"
    },
    "created_date": {
      "description": "The creation date of this fund",
      "type": ["string", "null"],
      "format": "date-time"
    },
    "fund_status": {
      "description": "The current status of this fund",
      "type": "string"
    },
    "currency": {
      "description": "The currency used for this fund",
      "type": "string"
    },
    "description": {
      "description": "The description of this fund",
      "type": "string"
    },
    "ledger_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}$"
    },
    "allocation_from": {
      "id": "allocation_from",
      "description": "The originating fund of the allocation",
      "type": "array",
      "items": {
        "type": "string",
        "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}$"
      }
    },
    "allocation_to": {
      "id": "allocation_to",
      "description": "The target fund of the allocation",
      "type": "array",
      "items": {
        "type": "string",
        "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}$"
      }
    },
    "tags": {
      "id": "tags",
      "description": "The list of tags associated with this fund",
      "type": "array",
      "items": {
        "type": "string",
        "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": [
    "name",
    "code"
  ]
}

Example:

{
  "id": "172364c7-AaAa-A0C2-C12C-e35CeCcbfaF2",
  "name": "History",
  "code": "HIST",
  "created_date": "2775-01-01T13:06:34.186Z",
  "fund_status": "Active",
  "currency": "USD",
  "description": "Tracking fund for the History department",
  "ledger_id": "7cef8378-7CBd-BFaE-BCdd-8b9d7c0af9De",
  "allocation_from": [
    "45cf58eb-BbDf-C4c6-97e1-33C8F3ddEd65",
    "7e4112ec-89F0-08eD-1eD5-0bE3fD9FCcFF"
  ],
  "allocation_to": [
    "f8d4511a-f6B8-ccec-ad4c-FA5bEAbaD092"
  ],
  "tags": [
    "cb365b12-5eCB-6C13-9F45-f8eaEcb52c76"
  ]
}

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": "172364c7-AaAa-A0C2-C12C-e35CeCcbfaF2",
  "name": "History",
  "code": "HIST",
  "created_date": "2775-01-01T13:06:34.186Z",
  "fund_status": "Active",
  "currency": "USD",
  "description": "Tracking fund for the History department",
  "ledger_id": "7cef8378-7CBd-BFaE-BCdd-8b9d7c0af9De",
  "allocation_from": [
    "45cf58eb-BbDf-C4c6-97e1-33C8F3ddEd65",
    "7e4112ec-89F0-08eD-1eD5-0bE3fD9FCcFF"
  ],
  "allocation_to": [
    "f8d4511a-f6B8-ccec-ad4c-FA5bEAbaD092"
  ],
  "tags": [
    "cb365b12-5eCB-6C13-9F45-f8eaEcb52c76"
  ]
}

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

Retrieve fund item with given {fundId}

GET /fund/{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": "A fund to track financial transactions",
  "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}$"
    },
    "name": {
      "description": "The name of this fund",
      "type": "string"
    },
    "code": {
      "description": "The numeric code for this fund",
      "type": "string"
    },
    "created_date": {
      "description": "The creation date of this fund",
      "type": ["string", "null"],
      "format": "date-time"
    },
    "fund_status": {
      "description": "The current status of this fund",
      "type": "string"
    },
    "currency": {
      "description": "The currency used for this fund",
      "type": "string"
    },
    "description": {
      "description": "The description of this fund",
      "type": "string"
    },
    "ledger_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}$"
    },
    "allocation_from": {
      "id": "allocation_from",
      "description": "The originating fund of the allocation",
      "type": "array",
      "items": {
        "type": "string",
        "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}$"
      }
    },
    "allocation_to": {
      "id": "allocation_to",
      "description": "The target fund of the allocation",
      "type": "array",
      "items": {
        "type": "string",
        "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}$"
      }
    },
    "tags": {
      "id": "tags",
      "description": "The list of tags associated with this fund",
      "type": "array",
      "items": {
        "type": "string",
        "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": [
    "name",
    "code"
  ]
}

Example:

{
  "id": "172364c7-AaAa-A0C2-C12C-e35CeCcbfaF2",
  "name": "History",
  "code": "HIST",
  "created_date": "2775-01-01T13:06:34.186Z",
  "fund_status": "Active",
  "currency": "USD",
  "description": "Tracking fund for the History department",
  "ledger_id": "7cef8378-7CBd-BFaE-BCdd-8b9d7c0af9De",
  "allocation_from": [
    "45cf58eb-BbDf-C4c6-97e1-33C8F3ddEd65",
    "7e4112ec-89F0-08eD-1eD5-0bE3fD9FCcFF"
  ],
  "allocation_to": [
    "f8d4511a-f6B8-ccec-ad4c-FA5bEAbaD092"
  ],
  "tags": [
    "cb365b12-5eCB-6C13-9F45-f8eaEcb52c76"
  ]
}

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

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

Delete fund item with given {fundId}

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

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

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

Update fund item with given {fundId}

PUT /fund/{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": "A fund to track financial transactions",
  "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}$"
    },
    "name": {
      "description": "The name of this fund",
      "type": "string"
    },
    "code": {
      "description": "The numeric code for this fund",
      "type": "string"
    },
    "created_date": {
      "description": "The creation date of this fund",
      "type": ["string", "null"],
      "format": "date-time"
    },
    "fund_status": {
      "description": "The current status of this fund",
      "type": "string"
    },
    "currency": {
      "description": "The currency used for this fund",
      "type": "string"
    },
    "description": {
      "description": "The description of this fund",
      "type": "string"
    },
    "ledger_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}$"
    },
    "allocation_from": {
      "id": "allocation_from",
      "description": "The originating fund of the allocation",
      "type": "array",
      "items": {
        "type": "string",
        "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}$"
      }
    },
    "allocation_to": {
      "id": "allocation_to",
      "description": "The target fund of the allocation",
      "type": "array",
      "items": {
        "type": "string",
        "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}$"
      }
    },
    "tags": {
      "id": "tags",
      "description": "The list of tags associated with this fund",
      "type": "array",
      "items": {
        "type": "string",
        "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": [
    "name",
    "code"
  ]
}

Example:

{
  "id": "172364c7-AaAa-A0C2-C12C-e35CeCcbfaF2",
  "name": "History",
  "code": "HIST",
  "created_date": "2775-01-01T13:06:34.186Z",
  "fund_status": "Active",
  "currency": "USD",
  "description": "Tracking fund for the History department",
  "ledger_id": "7cef8378-7CBd-BFaE-BCdd-8b9d7c0af9De",
  "allocation_from": [
    "45cf58eb-BbDf-C4c6-97e1-33C8F3ddEd65",
    "7e4112ec-89F0-08eD-1eD5-0bE3fD9FCcFF"
  ],
  "allocation_to": [
    "f8d4511a-f6B8-ccec-ad4c-FA5bEAbaD092"
  ],
  "tags": [
    "cb365b12-5eCB-6C13-9F45-f8eaEcb52c76"
  ]
}

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 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

internal server error, contact administrator