Vendors (v2.0)

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

Table of contents

Accounts

CRUD APIs used to manage accounts.

/vendor-storage/accounts

Collection of account items.

GET /vendor-storage/accounts

Get list of accounts

GET /vendor-storage/accounts
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 account items

Body

Media type: application/json

Type: json

Content:

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "description": "collection of account records",
    "type": "object",
    "properties": {
      "accounts": {
        "description": "The list of accounts in this collection",
        "type": "array",
        "id": "accounts",
        "items": {
          "type": "object",
          "$ref": "account.json"
        }
      },
      "total_records": {
        "description": "The number of account records returned 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": [
      "accounts",
      "total_records"
    ]
  }
  

Example:

{
    "accounts": [
        {
            "id": "588b5c42-8634-4af7-bc9b-5e0116ed96b6",
            "name": "History Account",
            "account_no": "GOBI-HIST-12",
            "description": "This is my account description.",
            "app_system_no": "FIN-GOBI-HIST-12",
            "payment_method": "EFT",
            "account_status": "Active",
            "contact_info": "Some basic contact information note.",
            "library_code": "My Library",
            "library_edi_code": "MY-LIB-1",
            "notes": ""
        }
    ],
    "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 accounts -- 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 accounts -- 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 /vendor-storage/accounts

Create a new account item.

POST /vendor-storage/accounts
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 vendor account",
  "type": "object",
  "properties": {
    "id": {
      "description": "The unique id of this category",
      "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 unique name of this account",
      "type": "string"
    },
    "account_no": {
      "description": "The unique number of this account",
      "type": "string"
    },
    "description": {
      "description": "The description of this account",
      "type": "string"
    },
    "app_system_no": {
      "description": "The unique name of this group",
      "type": "string"
    },
    "payment_method": {
      "description": "The method of payment for this account",
      "type": "string"
    },
    "account_status": {
      "description": "The status of this account",
      "type": "string"
    },
    "contact_info": {
      "description": "The contact info for the account",
      "type": "string"
    },
    "library_code": {
      "description": "The library code for this account",
      "type": "string"
    },
    "library_edi_code": {
      "description": "The EDI code for this account",
      "type": "string"
    },
    "notes": {
      "description": "The notes for this account",
      "type": "string"
    }
  },
  "additionalProperties": false,
  "required": [
    "name",
    "account_no",
    "payment_method",
    "account_status",
    "library_code",
    "library_edi_code"
  ]
}

Example:

{
    "name": "History Account",
    "account_no": "GOBI-HIST-12",
    "description": "This is my account description.",
    "app_system_no": "FIN-GOBI-HIST-12",
    "payment_method": "EFT",
    "account_status": "Active",
    "contact_info": "Some basic contact information note.",
    "library_code": "My Library",
    "library_edi_code": "MY-LIB-1",
    "notes": ""
}

Response 201

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

Headers
  • Location: required (string)

    URI to the created account item

Body

Media type: application/json

Type: any

Example:

{
    "name": "History Account",
    "account_no": "GOBI-HIST-12",
    "description": "This is my account description.",
    "app_system_no": "FIN-GOBI-HIST-12",
    "payment_method": "EFT",
    "account_status": "Active",
    "contact_info": "Some basic contact information note.",
    "library_code": "My Library",
    "library_edi_code": "MY-LIB-1",
    "notes": ""
}

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

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Example:

unable to create accounts -- 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 /vendor-storage/accounts/{id}

Retrieve account item with given {accountId}

GET /vendor-storage/accounts/{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 Account

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 vendor account",
  "type": "object",
  "properties": {
    "id": {
      "description": "The unique id of this category",
      "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 unique name of this account",
      "type": "string"
    },
    "account_no": {
      "description": "The unique number of this account",
      "type": "string"
    },
    "description": {
      "description": "The description of this account",
      "type": "string"
    },
    "app_system_no": {
      "description": "The unique name of this group",
      "type": "string"
    },
    "payment_method": {
      "description": "The method of payment for this account",
      "type": "string"
    },
    "account_status": {
      "description": "The status of this account",
      "type": "string"
    },
    "contact_info": {
      "description": "The contact info for the account",
      "type": "string"
    },
    "library_code": {
      "description": "The library code for this account",
      "type": "string"
    },
    "library_edi_code": {
      "description": "The EDI code for this account",
      "type": "string"
    },
    "notes": {
      "description": "The notes for this account",
      "type": "string"
    }
  },
  "additionalProperties": false,
  "required": [
    "name",
    "account_no",
    "payment_method",
    "account_status",
    "library_code",
    "library_edi_code"
  ]
}

Example:

{
    "name": "History Account",
    "account_no": "GOBI-HIST-12",
    "description": "This is my account description.",
    "app_system_no": "FIN-GOBI-HIST-12",
    "payment_method": "EFT",
    "account_status": "Active",
    "contact_info": "Some basic contact information note.",
    "library_code": "My Library",
    "library_edi_code": "MY-LIB-1",
    "notes": ""
}

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"account 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 /vendor-storage/accounts/{id}

Delete account item with given {accountId}

DELETE /vendor-storage/accounts/{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 Account

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

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"account 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 /vendor-storage/accounts/{id}

Update account item with given {accountId}

PUT /vendor-storage/accounts/{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 Account

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 vendor account",
  "type": "object",
  "properties": {
    "id": {
      "description": "The unique id of this category",
      "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 unique name of this account",
      "type": "string"
    },
    "account_no": {
      "description": "The unique number of this account",
      "type": "string"
    },
    "description": {
      "description": "The description of this account",
      "type": "string"
    },
    "app_system_no": {
      "description": "The unique name of this group",
      "type": "string"
    },
    "payment_method": {
      "description": "The method of payment for this account",
      "type": "string"
    },
    "account_status": {
      "description": "The status of this account",
      "type": "string"
    },
    "contact_info": {
      "description": "The contact info for the account",
      "type": "string"
    },
    "library_code": {
      "description": "The library code for this account",
      "type": "string"
    },
    "library_edi_code": {
      "description": "The EDI code for this account",
      "type": "string"
    },
    "notes": {
      "description": "The notes for this account",
      "type": "string"
    }
  },
  "additionalProperties": false,
  "required": [
    "name",
    "account_no",
    "payment_method",
    "account_status",
    "library_code",
    "library_edi_code"
  ]
}

Example:

{
    "name": "History Account",
    "account_no": "GOBI-HIST-12",
    "description": "This is my account description.",
    "app_system_no": "FIN-GOBI-HIST-12",
    "payment_method": "EFT",
    "account_status": "Active",
    "contact_info": "Some basic contact information note.",
    "library_code": "My Library",
    "library_edi_code": "MY-LIB-1",
    "notes": ""
}

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

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

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