mod-orders-storage (v1)

http://github.com/folio-org/mod-orders-storage

Table of contents

mod-orders

This module implements the CRUD interface

/purchase_order

Collection of purchase_order items.

GET /purchase_order

Get list of purchase orders

GET /purchase_order
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 purchase_order items

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "collection of purchase order records",
  "type": "object",
  "properties": {
    "purchase_orders": {
      "description": "collection of purchase order records",
      "type": "array",
      "id": "purchase_orders",
      "items": {
        "type": "object",
        "$ref": "purchase_order.json"
      }
    },
    "total_records": {
      "description": "The number of objects contained in this collection",
      "type": "integer"
    },
    "first": {
      "description": "The index of the first object contained in this collection",
      "type": "integer"
    },
    "last": {
      "description": "The index of the last object contained in this collection",
      "type": "integer"
    }
  },
  "additionalProperties": false,
  "required": [
    "purchase_orders",
    "total_records"
  ]
}

Example:

{
  "purchase_orders": [
    {
      "id": "0804ddec-6545-404a-b54d-a693f505681d",
      "adjustment": "9b3be694-6716-4e14-b81d-8d76f0ae4146",
      "approved": true,
      "assigned_to": "ab18897b-0e40-4f31-896b-9c9adc979a88",
      "created": "2010-10-08T03:53:00.000Z",
      "created_by": "ab18897b-0e40-4f31-896b-9c9adc979a88",
      "manual_po": false,
      "notes": [
        "ABCDEFGHIJKLMNO",
        "ABCDEFGHIJKLMNOPQRST",
        "ABCDEFGHIJKLMNOPQRSTUV"
      ],
      "order_type": "Ongoing",
      "po_number": "268758",
      "re_encumber": false,
      "total_estimated_price": 49.98,
      "total_items": 2,
      "vendor": "168f8a86-d26c-406e-813f-c7527f241ac3",
      "workflow_status": "Open"
    }
  ],
  "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 purchase_order -- 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 purchase_order -- 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 /purchase_order

Create a new purchase_order item.

POST /purchase_order
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": "purchase order",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of this purchase order",
      "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}$"
    },
    "adjustment": {
      "description": "UUID of the adjustment record associated with this order",
      "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}$"
    },
    "approved": {
      "description": "whether or not the purchase order has been approved",
      "type": "boolean"
    },
    "assigned_to": {
      "description": "UUID of the user this purchase order his assigned to",
      "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}$"
    },
    "created": {
      "description": "date/time when this purchase order was created",
      "type": "string",
      "format": "date-time"
    },
    "created_by": {
      "description": "UUID of the user this purchase order was created by",
      "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}$"
    },
    "manual_po": {
      "description": "if true, order cannot be sent automatically, e.g. via EDI",
      "type": "boolean"
    },
    "notes": {
      "description": "free-form notes associated with this purchase order",
      "id": "notes",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "po_number": {
      "description": "A human readable ID assigned to this purchase order",
      "type": "string",
      "pattern": "^[a-zA-Z0-9]{5,16}$"
    },
    "order_type": {
      "description": "the purchase order type",
      "type": "string",
      "enum": [
        "One-Time",
        "Ongoing"
      ]
    },
    "re_encumber": {
      "description": "indicates this purchase order should be re-encumbered each fiscal year. Only applies to ongoing orders",
      "type": "boolean"
    },
    "total_estimated_price": {
      "description": "total estimated price of this purchase order",
      "type": "number"
    },
    "total_items": {
      "description": "total number of items included in the purchase order",
      "type": "integer"
    },
    "vendor": {
      "description": "UUID of the vendor_details record",
      "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}$"
    },
    "workflow_status": {
      "description": "the workflow status for this purchase order",
      "type": "string",
      "enum": [
        "Pending",
        "Open",
        "Closed"
      ]
    }
  },
  "additionalProperties": false
}

Example:

{
  "id": "0804ddec-6545-404a-b54d-a693f505681d",
  "adjustment": "9b3be694-6716-4e14-b81d-8d76f0ae4146",
  "approved": true,
  "assigned_to": "ab18897b-0e40-4f31-896b-9c9adc979a88",
  "created": "2010-10-08T03:53:00.000Z",
  "created_by": "ab18897b-0e40-4f31-896b-9c9adc979a88",
  "manual_po": false,
  "notes": [
    "ABCDEFGHIJKLMNO",
    "ABCDEFGHIJKLMNOPQRST",
    "ABCDEFGHIJKLMNOPQRSTUV"
  ],
  "order_type": "Ongoing",
  "po_number": "268758",
  "re_encumber": false,
  "total_estimated_price": 49.98,
  "total_items": 2,
  "vendor": "168f8a86-d26c-406e-813f-c7527f241ac3",
  "workflow_status": "Open"
}

Response 201

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

Headers
  • Location: required (string)

    URI to the created purchase_order item

Body

Media type: application/json

Type: any

Example:

{
  "id": "0804ddec-6545-404a-b54d-a693f505681d",
  "adjustment": "9b3be694-6716-4e14-b81d-8d76f0ae4146",
  "approved": true,
  "assigned_to": "ab18897b-0e40-4f31-896b-9c9adc979a88",
  "created": "2010-10-08T03:53:00.000Z",
  "created_by": "ab18897b-0e40-4f31-896b-9c9adc979a88",
  "manual_po": false,
  "notes": [
    "ABCDEFGHIJKLMNO",
    "ABCDEFGHIJKLMNOPQRST",
    "ABCDEFGHIJKLMNOPQRSTUV"
  ],
  "order_type": "Ongoing",
  "po_number": "268758",
  "re_encumber": false,
  "total_estimated_price": 49.98,
  "total_items": 2,
  "vendor": "168f8a86-d26c-406e-813f-c7527f241ac3",
  "workflow_status": "Open"
}

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

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Example:

unable to create purchase_order -- 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 /purchase_order/{id}

Retrieve purchase_order item with given {purchase_orderId}

GET /purchase_order/{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": "purchase order",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of this purchase order",
      "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}$"
    },
    "adjustment": {
      "description": "UUID of the adjustment record associated with this order",
      "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}$"
    },
    "approved": {
      "description": "whether or not the purchase order has been approved",
      "type": "boolean"
    },
    "assigned_to": {
      "description": "UUID of the user this purchase order his assigned to",
      "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}$"
    },
    "created": {
      "description": "date/time when this purchase order was created",
      "type": "string",
      "format": "date-time"
    },
    "created_by": {
      "description": "UUID of the user this purchase order was created by",
      "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}$"
    },
    "manual_po": {
      "description": "if true, order cannot be sent automatically, e.g. via EDI",
      "type": "boolean"
    },
    "notes": {
      "description": "free-form notes associated with this purchase order",
      "id": "notes",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "po_number": {
      "description": "A human readable ID assigned to this purchase order",
      "type": "string",
      "pattern": "^[a-zA-Z0-9]{5,16}$"
    },
    "order_type": {
      "description": "the purchase order type",
      "type": "string",
      "enum": [
        "One-Time",
        "Ongoing"
      ]
    },
    "re_encumber": {
      "description": "indicates this purchase order should be re-encumbered each fiscal year. Only applies to ongoing orders",
      "type": "boolean"
    },
    "total_estimated_price": {
      "description": "total estimated price of this purchase order",
      "type": "number"
    },
    "total_items": {
      "description": "total number of items included in the purchase order",
      "type": "integer"
    },
    "vendor": {
      "description": "UUID of the vendor_details record",
      "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}$"
    },
    "workflow_status": {
      "description": "the workflow status for this purchase order",
      "type": "string",
      "enum": [
        "Pending",
        "Open",
        "Closed"
      ]
    }
  },
  "additionalProperties": false
}

Example:

{
  "id": "0804ddec-6545-404a-b54d-a693f505681d",
  "adjustment": "9b3be694-6716-4e14-b81d-8d76f0ae4146",
  "approved": true,
  "assigned_to": "ab18897b-0e40-4f31-896b-9c9adc979a88",
  "created": "2010-10-08T03:53:00.000Z",
  "created_by": "ab18897b-0e40-4f31-896b-9c9adc979a88",
  "manual_po": false,
  "notes": [
    "ABCDEFGHIJKLMNO",
    "ABCDEFGHIJKLMNOPQRST",
    "ABCDEFGHIJKLMNOPQRSTUV"
  ],
  "order_type": "Ongoing",
  "po_number": "268758",
  "re_encumber": false,
  "total_estimated_price": 49.98,
  "total_items": 2,
  "vendor": "168f8a86-d26c-406e-813f-c7527f241ac3",
  "workflow_status": "Open"
}

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

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

Delete purchase_order item with given {purchase_orderId}

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

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

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

Update purchase_order item with given {purchase_orderId}

PUT /purchase_order/{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": "purchase order",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of this purchase order",
      "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}$"
    },
    "adjustment": {
      "description": "UUID of the adjustment record associated with this order",
      "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}$"
    },
    "approved": {
      "description": "whether or not the purchase order has been approved",
      "type": "boolean"
    },
    "assigned_to": {
      "description": "UUID of the user this purchase order his assigned to",
      "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}$"
    },
    "created": {
      "description": "date/time when this purchase order was created",
      "type": "string",
      "format": "date-time"
    },
    "created_by": {
      "description": "UUID of the user this purchase order was created by",
      "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}$"
    },
    "manual_po": {
      "description": "if true, order cannot be sent automatically, e.g. via EDI",
      "type": "boolean"
    },
    "notes": {
      "description": "free-form notes associated with this purchase order",
      "id": "notes",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "po_number": {
      "description": "A human readable ID assigned to this purchase order",
      "type": "string",
      "pattern": "^[a-zA-Z0-9]{5,16}$"
    },
    "order_type": {
      "description": "the purchase order type",
      "type": "string",
      "enum": [
        "One-Time",
        "Ongoing"
      ]
    },
    "re_encumber": {
      "description": "indicates this purchase order should be re-encumbered each fiscal year. Only applies to ongoing orders",
      "type": "boolean"
    },
    "total_estimated_price": {
      "description": "total estimated price of this purchase order",
      "type": "number"
    },
    "total_items": {
      "description": "total number of items included in the purchase order",
      "type": "integer"
    },
    "vendor": {
      "description": "UUID of the vendor_details record",
      "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}$"
    },
    "workflow_status": {
      "description": "the workflow status for this purchase order",
      "type": "string",
      "enum": [
        "Pending",
        "Open",
        "Closed"
      ]
    }
  },
  "additionalProperties": false
}

Example:

{
  "id": "0804ddec-6545-404a-b54d-a693f505681d",
  "adjustment": "9b3be694-6716-4e14-b81d-8d76f0ae4146",
  "approved": true,
  "assigned_to": "ab18897b-0e40-4f31-896b-9c9adc979a88",
  "created": "2010-10-08T03:53:00.000Z",
  "created_by": "ab18897b-0e40-4f31-896b-9c9adc979a88",
  "manual_po": false,
  "notes": [
    "ABCDEFGHIJKLMNO",
    "ABCDEFGHIJKLMNOPQRST",
    "ABCDEFGHIJKLMNOPQRSTUV"
  ],
  "order_type": "Ongoing",
  "po_number": "268758",
  "re_encumber": false,
  "total_estimated_price": 49.98,
  "total_items": 2,
  "vendor": "168f8a86-d26c-406e-813f-c7527f241ac3",
  "workflow_status": "Open"
}

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

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

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