foliolib.folio.api.orders.OrderTemplates

class foliolib.folio.api.orders.OrderTemplates(tenant: str, okapi: Optional[foliolib.okapi.okapiClient.OkapiClient] = None)

Bases: foliolib.folio.FolioApi

Orders Business Logic API

API for managing order templates

Parameters
  • tenant (str) – Tenant id

  • okapi (OkapiClient, optional) – Instance of OkapiClient. Defaults to None.

Methods

delete_orderTemplate(orderTemplatesId)

Delete orderTemplate item with given {orderTemplateId}

get_orderTemplate(orderTemplatesId)

Retrieve orderTemplate item with given {orderTemplateId}

get_orderTemplates(**kwargs)

Get list of order templates

modify_orderTemplate(orderTemplatesId, ...)

Update order template

set_orderTemplate(orderTemplate)

Create new order template

delete_orderTemplate(orderTemplatesId: str)

Delete orderTemplate item with given {orderTemplateId}

DELETE /orders/order-templates/{orderTemplatesId}

Parameters

orderTemplatesId (str) –

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestError – Bad Request

  • OkapiFatalError – Server Error

get_orderTemplate(orderTemplatesId: str)

Retrieve orderTemplate item with given {orderTemplateId}

GET /orders/order-templates/{orderTemplatesId}

Parameters

orderTemplatesId (str) –

Returns

See Schema below

Return type

dict

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiFatalError – Server Error

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Order template",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of order template",
      "$ref": "../../common/schemas/uuid.json"
    },
    "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"
    }
  },
  "additionalProperties": true,
  "required": [
    "templateName"
  ]
}
get_orderTemplates(**kwargs)

Get list of order templates

GET /orders/order-templates

Parameters

**kwargs (properties) – Keyword Arguments

Keyword Arguments
  • query (str) –

    A query expressed as a CQL string (see [dev.folio.org/reference/glossary#cql](https://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 (str) –

    (default=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 (int) –

    (default=0) Skip over a number of elements by specifying an offset value for the query

    Example

    • 0

  • limit (int) –

    (default=10) Limit the number of elements returned in the response

    Example

    • 10

Returns

See Schema below

Return type

dict

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnauthorized – Authentication is required

  • OkapiFatalError – Server Error

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Collection of order templates",
  "type": "object",
  "properties": {
    "orderTemplates": {
      "description": "Collection of order templates",
      "type": "array",
      "id": "orderTemplates",
      "items": {
        "type": "object",
        "$ref": "order_template.json"
      }
    },
    "totalRecords": {
      "description": "The number of objects contained in this collection",
      "type": "integer"
    }
  },
  "additionalProperties": false,
  "required": [
    "orderTemplates",
    "totalRecords"
  ]
}
modify_orderTemplate(orderTemplatesId: str, orderTemplate: dict)

Update order template

PUT /orders/order-templates/{orderTemplatesId}

Parameters
  • orderTemplatesId (str) –

  • orderTemplate (dict) – See Schema below

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestError – Bad Request

  • OkapiFatalError – Server Error

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Order template",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of order template",
      "$ref": "../../common/schemas/uuid.json"
    },
    "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"
    }
  },
  "additionalProperties": true,
  "required": [
    "templateName"
  ]
}
set_orderTemplate(orderTemplate: dict)

Create new order template

POST /orders/order-templates

Parameters

orderTemplate (dict) – See Schema below

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnauthorized – Authentication is required

  • OkapiFatalError – Server Error

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Headers

  • Location - URI to the created orderTemplate item

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Order template",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of order template",
      "$ref": "../../common/schemas/uuid.json"
    },
    "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"
    }
  },
  "additionalProperties": true,
  "required": [
    "templateName"
  ]
}