Order-templates (v1)

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

Table of contents

Orders Business Logic API

API for managing order templates

/orders/order-templates

Collection of order-template items.

POST /orders/order-templates

Create new order template

POST /orders/order-templates
Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Order template",
  "type": "object",
  "javaName": "OrderTemplate",
  "properties": {
    "id": {
      "description": "UUID of order template",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "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}$"
    },
    "templateName": {
      "description": "The order template name",
      "type": "string"
    },
    "templateCode": {
      "description": "The order template code",
      "type": "string"
    },
    "templateDescription": {
      "description": "The order template description",
      "type": "string"
    },
    "hiddenFields": {
      "description": "Fields for hidden from end user",
      "type": "object"
    },
    "categoryIds": {
      "description": "UUIDs of order template categories",
      "type": "array",
      "items": {
        "description": "UUID of order template category",
        "$schema": "http://json-schema.org/draft-04/schema#",
        "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": true,
  "required": [
    "templateName"
  ]
}

Example:

{
   "templateName": "Amazon book orders",
   "templateCode": "Amazon-B",
   "templateDescription": "Use to create orders in FOLIO after they are placed on Amazon"
}

Response 201

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

Headers
  • Location: required (string)

    URI to the created order-template item

Body

Media type: application/json

Type: any

Example:

{
   "templateName": "Amazon book orders",
   "templateCode": "Amazon-B",
   "templateDescription": "Use to create orders in FOLIO after they are placed on Amazon"
}

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: application/json

Type: any

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

Media type: text/plain

Type: any

Example:

"unable to add order-template -- malformed JSON at 13:3"

Response 401

Not authorized to perform requested action

Body

Media type: application/json

Type: any

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

Media type: text/plain

Type: any

Example:

unable to create order-templates -- unauthorized

Response 422

Validation errors

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "errors.schema",
  "description": "A set of errors",
  "type": "object",
  "properties": {
    "errors": {
      "description": "List of errors",
      "id": "errors",
      "type": "array",
      "items": {
        "type": "object",
        "$schema": "http://json-schema.org/draft-04/schema#",
        "id": "error.schema",
        "description": "An error",
        "properties": {
          "message": {
            "type": "string",
            "description": "Error message text"
          },
          "type": {
            "type": "string",
            "description": "Error message type"
          },
          "code": {
            "type": "string",
            "description": "Error message code"
          },
          "parameters": {
            "description": "Error message parameters",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "id": "parameters.schema",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "value": {
                  "type": "string"
                }
              }
            }
          }
        },
        "required": [
          "message"
        ]
      }
    },
    "total_records": {
      "description": "Total number of errors",
      "type": "integer"
    }
  }
}

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: application/json

Type: any

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

Media type: text/plain

Type: any

Example:

Internal server error, contact administrator

GET /orders/order-templates

Get list of order templates

GET /orders/order-templates
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 templateCode

    Example:

    (username=="ab*" or personal.firstName=="ab*" or personal.lastName=="ab*") and active=="true" sortby personal.lastName personal.firstName barcode
    
    ["templateCode", "Amazon", "="]
    
  • totalRecords: (string - default: auto - pattern: exact|estimated|none|auto)

    How to calculate the totalRecords property. "exact" for the correct number, "estimated" for an estimation, "auto" to automatically select "exact" or "estimated", "none" for suppressing the totalRecords property. For details see https://github.com/folio-org/raml-module-builder#estimated-totalrecords

    Example:

    none
  • 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

Response 200

Returns a list of order-template items

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Collection of order templates",
  "type": "object",
  "javaName": "OrderTemplateCollection",
  "properties": {
    "orderTemplates": {
      "description": "Collection of order templates",
      "type": "array",
      "id": "orderTemplates",
      "items": {
        "type": "object",
        "$schema": "http://json-schema.org/draft-04/schema#",
        "description": "Order template",
        "javaName": "OrderTemplate",
        "properties": {
          "id": {
            "description": "UUID of order template",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "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}$"
          },
          "templateName": {
            "description": "The order template name",
            "type": "string"
          },
          "templateCode": {
            "description": "The order template code",
            "type": "string"
          },
          "templateDescription": {
            "description": "The order template description",
            "type": "string"
          },
          "hiddenFields": {
            "description": "Fields for hidden from end user",
            "type": "object"
          },
          "categoryIds": {
            "description": "UUIDs of order template categories",
            "type": "array",
            "items": {
              "description": "UUID of order template category",
              "$schema": "http://json-schema.org/draft-04/schema#",
              "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": true,
        "required": [
          "templateName"
        ]
      }
    },
    "totalRecords": {
      "description": "The number of objects contained in this collection",
      "type": "integer"
    }
  },
  "additionalProperties": false,
  "required": [
    "orderTemplates",
    "totalRecords"
  ]
}

Example:

{
   "orderTemplates":[
      {
         "id": "4dee318b-f5b3-40dc-be93-cc89b8c45b6f",
         "templateName": "Amazon book orders",
         "templateCode": "Amazon-B",
         "templateDescription": "Use to create orders in FOLIO after they are placed on Amazon"
      }
   ],
   "totalRecords":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: application/json

Type: any

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

Media type: text/plain

Type: any

Example:

unable to list order-templates -- malformed parameter 'query', syntax error at column 6

Response 401

Not authorized to perform requested action

Body

Media type: application/json

Type: any

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

Media type: text/plain

Type: any

Example:

unable to list order-templates -- unauthorized

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: application/json

Type: any

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

Media type: text/plain

Type: any

Example:

internal server error, contact administrator

PUT /orders/order-templates/{id}

Update order template

PUT /orders/order-templates/{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 an Order Template

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Order template",
  "type": "object",
  "javaName": "OrderTemplate",
  "properties": {
    "id": {
      "description": "UUID of order template",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "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}$"
    },
    "templateName": {
      "description": "The order template name",
      "type": "string"
    },
    "templateCode": {
      "description": "The order template code",
      "type": "string"
    },
    "templateDescription": {
      "description": "The order template description",
      "type": "string"
    },
    "hiddenFields": {
      "description": "Fields for hidden from end user",
      "type": "object"
    },
    "categoryIds": {
      "description": "UUIDs of order template categories",
      "type": "array",
      "items": {
        "description": "UUID of order template category",
        "$schema": "http://json-schema.org/draft-04/schema#",
        "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": true,
  "required": [
    "templateName"
  ]
}

Example:

{
   "id": "4dee318b-f5b3-40dc-be93-cc89b8c45b6f",
   "templateName": "Amazon book orders",
   "templateCode": "Amazon-B",
   "templateDescription": "Use to create orders in FOLIO after they are placed on Amazon",
   "categoryIds": [
     "3dee318b-f5b3-40dc-be93-cc89b8c45b6f",
     "aadeee05-5349-4669-b9bf-ff817488e223"
   ]
}

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: application/json

Type: any

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

Media type: text/plain

Type: any

Example:

"unable to update order-template -- malformed JSON at 13:4"

Response 404

Item with a given ID not found

Body

Media type: application/json

Type: any

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

Media type: text/plain

Type: any

Example:

"order-template not found"

Response 422

Validation errors

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "errors.schema",
  "description": "A set of errors",
  "type": "object",
  "properties": {
    "errors": {
      "description": "List of errors",
      "id": "errors",
      "type": "array",
      "items": {
        "type": "object",
        "$schema": "http://json-schema.org/draft-04/schema#",
        "id": "error.schema",
        "description": "An error",
        "properties": {
          "message": {
            "type": "string",
            "description": "Error message text"
          },
          "type": {
            "type": "string",
            "description": "Error message type"
          },
          "code": {
            "type": "string",
            "description": "Error message code"
          },
          "parameters": {
            "description": "Error message parameters",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "id": "parameters.schema",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "value": {
                  "type": "string"
                }
              }
            }
          }
        },
        "required": [
          "message"
        ]
      }
    },
    "total_records": {
      "description": "Total number of errors",
      "type": "integer"
    }
  }
}

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: application/json

Type: any

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

Media type: text/plain

Type: any

Example:

internal server error, contact administrator

GET /orders/order-templates/{id}

Retrieve order-template item with given {order-templateId}

GET /orders/order-templates/{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 an Order Template

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": "Order template",
  "type": "object",
  "javaName": "OrderTemplate",
  "properties": {
    "id": {
      "description": "UUID of order template",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "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}$"
    },
    "templateName": {
      "description": "The order template name",
      "type": "string"
    },
    "templateCode": {
      "description": "The order template code",
      "type": "string"
    },
    "templateDescription": {
      "description": "The order template description",
      "type": "string"
    },
    "hiddenFields": {
      "description": "Fields for hidden from end user",
      "type": "object"
    },
    "categoryIds": {
      "description": "UUIDs of order template categories",
      "type": "array",
      "items": {
        "description": "UUID of order template category",
        "$schema": "http://json-schema.org/draft-04/schema#",
        "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": true,
  "required": [
    "templateName"
  ]
}

Example:

{
   "id": "4dee318b-f5b3-40dc-be93-cc89b8c45b6f",
   "templateName": "Amazon book orders",
   "templateCode": "Amazon-B",
   "templateDescription": "Use to create orders in FOLIO after they are placed on Amazon",
   "categoryIds": [
     "3dee318b-f5b3-40dc-be93-cc89b8c45b6f",
     "aadeee05-5349-4669-b9bf-ff817488e223"
   ]
}

Response 404

Item with a given ID not found

Body

Media type: application/json

Type: any

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

Media type: text/plain

Type: any

Example:

"order-template not found"

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: application/json

Type: any

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

Media type: text/plain

Type: any

Example:

internal server error, contact administrator

DELETE /orders/order-templates/{id}

Delete order-template item with given {order-templateId}

DELETE /orders/order-templates/{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 an Order Template

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: application/json

Type: any

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

Media type: text/plain

Type: any

Example:

"unable to delete order-template -- constraint violation"

Response 404

Item with a given ID not found

Body

Media type: application/json

Type: any

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

Media type: text/plain

Type: any

Example:

"order-template not found"

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: application/json

Type: any

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

Media type: text/plain

Type: any

Example:

Internal server error, contact administrator