mod-funds (v1)

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

Table of contents

mod-funds (Fund Distributions)

CRUD APIs used to manage fund-distributions.

/fund_distribution

Collection of fund_distribution items.

GET /fund_distribution

Get list of fund distributions

GET /fund_distribution
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_distribution items

Body

Media type: application/json

Type: json

Content:

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

Example:

{
  "distributions": [
    {
      "id": "4c58e097-3bef-67f9-B4B3-e1Fa4CCbF12D",
      "amount": 25,
      "currency": "USD",
      "percent": 100,
      "source_type": "PO Line",
      "source_id": "906eb7a4-8BbC-1CCf-6cAF-de909eABeedd",
      "budget_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 fund_distribution -- 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_distribution -- 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_distribution

Create a new fund_distribution item.

POST /fund_distribution
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 distribution 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": {
      "description": "The amount of this fund distribution",
      "type": "number"
    },
    "currency": {
      "description": "The currency used for this fund distribution",
      "type": "string"
    },
    "percent": {
      "description": "The percent of this fund distribution",
      "type": "number"
    },
    "source_type": {
      "description": "The type of source of this fund distribution",
      "type": "string"
    },
    "source_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}$"
    },
    "budget_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": [
    "amount"
  ]
}

Example:

{
  "id": "4c58e097-3bef-67f9-B4B3-e1Fa4CCbF12D",
  "amount": 25,
  "currency": "USD",
  "percent": 100,
  "source_type": "PO_Line",
  "source_id": "906eb7a4-8BbC-1CCf-6cAF-de909eABeedd",
  "budget_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 fund_distribution item

Body

Media type: application/json

Type: any

Example:

{
  "id": "4c58e097-3bef-67f9-B4B3-e1Fa4CCbF12D",
  "amount": 25,
  "currency": "USD",
  "percent": 100,
  "source_type": "PO_Line",
  "source_id": "906eb7a4-8BbC-1CCf-6cAF-de909eABeedd",
  "budget_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 fund_distribution -- 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_distribution -- 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_distribution/{id}

Retrieve fund_distribution item with given {fund_distributionId}

GET /fund_distribution/{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 distribution 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": {
      "description": "The amount of this fund distribution",
      "type": "number"
    },
    "currency": {
      "description": "The currency used for this fund distribution",
      "type": "string"
    },
    "percent": {
      "description": "The percent of this fund distribution",
      "type": "number"
    },
    "source_type": {
      "description": "The type of source of this fund distribution",
      "type": "string"
    },
    "source_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}$"
    },
    "budget_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": [
    "amount"
  ]
}

Example:

{
  "id": "4c58e097-3bef-67f9-B4B3-e1Fa4CCbF12D",
  "amount": 25,
  "currency": "USD",
  "percent": 100,
  "source_type": "PO_Line",
  "source_id": "906eb7a4-8BbC-1CCf-6cAF-de909eABeedd",
  "budget_id": "47Ac60b4-159D-4e1c-9aCB-8293Df67D16d"
}

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

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

Delete fund_distribution item with given {fund_distributionId}

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

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

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

Update fund_distribution item with given {fund_distributionId}

PUT /fund_distribution/{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 distribution 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": {
      "description": "The amount of this fund distribution",
      "type": "number"
    },
    "currency": {
      "description": "The currency used for this fund distribution",
      "type": "string"
    },
    "percent": {
      "description": "The percent of this fund distribution",
      "type": "number"
    },
    "source_type": {
      "description": "The type of source of this fund distribution",
      "type": "string"
    },
    "source_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}$"
    },
    "budget_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": [
    "amount"
  ]
}

Example:

{
  "id": "4c58e097-3bef-67f9-B4B3-e1Fa4CCbF12D",
  "amount": 25,
  "currency": "USD",
  "percent": 100,
  "source_type": "PO_Line",
  "source_id": "906eb7a4-8BbC-1CCf-6cAF-de909eABeedd",
  "budget_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 fund_distribution -- malformed JSON at 13:4"

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

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