Orders Storage (v1)

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

Table of contents

Order relationship

CRUD APIs used to manage relationship between order and invoice.

/orders-storage/order-invoice-relns

Collection of order-invoice-reln items.

GET /orders-storage/order-invoice-relns

Get list of relationships

GET /orders-storage/order-invoice-relns
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 purchaseOrderId

    Example:

    (username=="ab*" or personal.firstName=="ab*" or personal.lastName=="ab*") and active=="true" sortby personal.lastName personal.firstName barcode
    
    ["purchaseOrderId", "55b97a4a-6601-4488-84e1-8b0d47a3f523"]
    
  • 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 order-invoice-reln items

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Collection of relationship between invoice and order",
  "type": "object",
  "properties": {
    "orderInvoiceRelationships": {
      "description": "Collection of relationship",
      "type": "array",
      "id": "order_invoice_relationship",
      "items": {
        "type": "object",
        "$ref": "order_invoice_relationship.json"
      }
    },
    "totalRecords": {
      "description": "The number of objects contained in this collection",
      "type": "integer"
    }
  },
  "additionalProperties": false,
  "required": [
    "orderInvoiceRelationships",
    "totalRecords"
  ]
}

Example:

{
  "orderInvoiceRelationships":
    [
     {
        "id": "2A1030d4-C4EC-5A66-8EfC-3fc8e608e2De",
        "purchaseOrderId": "0610be6d-0ddd-494b-b867-19f63d8b5d6d",
        "invoiceId": "c0d08448-347b-418a-8c2f-5fb50248d67e"
     },
     {
        "id": "DbDD493a-345c-4D0C-aFb5-6CdDB6a3FEE9",
        "purchaseOrderId": "589a6016-3463-49f6-8aa2-dc315d0665fd",
        "invoiceId": "9917d4a6-fbb2-4ed6-946d-6cf8c42369e4"
     },
     {
        "id": "bA0A09Be-cAeB-2Fbd-a5fb-6bf962BCcBbF",
        "purchaseOrderId": "9447d062-89ec-486e-a14b-572f3efb9f8c",
        "invoiceId": "e6ac6e5b-2dde-4904-bc2d-def3a0b17052"
     }
    ],
  "totalRecords": 3
}

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 order-invoice-relns -- 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 order-invoice-relns -- 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 /orders-storage/order-invoice-relns

Create a new order-invoice-reln item.

POST /orders-storage/order-invoice-relns
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": "Relationship between order and invoice",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of this relationship 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}$"
    },
    "purchaseOrderId": {
      "description": "Purchase order id",
      "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}$"
    },
    "invoiceId": {
      "description": "Invoice id",
      "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}$"
    }
  },
  "additionalProperties": false,
  "required": [
    "purchaseOrderId",
    "invoiceId"
  ]
}

Example:

{
  "purchaseOrderId": "0610be6d-0ddd-494b-b867-19f63d8b5d6d",
  "invoiceId": "c0d08448-347b-418a-8c2f-5fb50248d67e"
}

Response 201

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

Headers
  • Location: required (string)

    URI to the created order-invoice-reln item

Body

Media type: application/json

Type: any

Example:

{
  "purchaseOrderId": "0610be6d-0ddd-494b-b867-19f63d8b5d6d",
  "invoiceId": "c0d08448-347b-418a-8c2f-5fb50248d67e"
}

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 order-invoice-reln -- malformed JSON at 13:3"

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Example:

unable to create order-invoice-relns -- 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 /orders-storage/order-invoice-relns/{id}

Retrieve order-invoice-reln item with given {order-invoice-relnId}

GET /orders-storage/order-invoice-relns/{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 relationship between order and invoice

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": "Relationship between order and invoice",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of this relationship 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}$"
    },
    "purchaseOrderId": {
      "description": "Purchase order id",
      "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}$"
    },
    "invoiceId": {
      "description": "Invoice id",
      "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}$"
    }
  },
  "additionalProperties": false,
  "required": [
    "purchaseOrderId",
    "invoiceId"
  ]
}

Example:

{
  "purchaseOrderId": "0610be6d-0ddd-494b-b867-19f63d8b5d6d",
  "invoiceId": "c0d08448-347b-418a-8c2f-5fb50248d67e"
}

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"order-invoice-reln 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 /orders-storage/order-invoice-relns/{id}

Delete order-invoice-reln item with given {order-invoice-relnId}

DELETE /orders-storage/order-invoice-relns/{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 relationship between order and invoice

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 order-invoice-reln -- constraint violation"

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"order-invoice-reln 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 /orders-storage/order-invoice-relns/{id}

Update order-invoice-reln item with given {order-invoice-relnId}

PUT /orders-storage/order-invoice-relns/{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 relationship between order and invoice

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": "Relationship between order and invoice",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of this relationship 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}$"
    },
    "purchaseOrderId": {
      "description": "Purchase order id",
      "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}$"
    },
    "invoiceId": {
      "description": "Invoice id",
      "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}$"
    }
  },
  "additionalProperties": false,
  "required": [
    "purchaseOrderId",
    "invoiceId"
  ]
}

Example:

{
  "purchaseOrderId": "0610be6d-0ddd-494b-b867-19f63d8b5d6d",
  "invoiceId": "c0d08448-347b-418a-8c2f-5fb50248d67e"
}

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 order-invoice-reln -- malformed JSON at 13:4"

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"order-invoice-reln 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