foliolib.folio.api.orders.Pieces

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

Bases: foliolib.folio.FolioApi

Orders Business Logic API

API for managing pieces

Parameters
  • tenant (str) – Tenant id

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

Methods

delete_piece(piecesId)

Delete a piece with given {id}

get_piece(piecesId)

Return a piece record with given {id}

get_pieces(**kwargs)

Retrieve a list of piece items.

modify_piece(piecesId, piece)

Update a piece record with given {id}

set_piece(piece)

Create piece record

delete_piece(piecesId: str)

Delete a piece with given {id}

DELETE /orders/pieces/{piecesId}

Parameters

piecesId (str) –

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestError – Bad Request

  • OkapiFatalError – Server Error

get_piece(piecesId: str)

Return a piece record with given {id}

GET /orders/pieces/{piecesId}

Parameters

piecesId (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": "Piece details",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of this piece record",
      "$ref": "../../common/schemas/uuid.json"
    },
    "caption": {
      "description": "Volume/enumeration information",
      "type": "string"
    },
    "comment": {
      "description": "Free form commentary",
      "type": "string"
    },
    "format": {
      "description": "The format of the piece",
      "type": "string",
      "$ref": "piece_format.json"
    },
    "itemId": {
      "description": "UUID of the associated item record",
      "$ref": "../../common/schemas/uuid.json"
    },
    "locationId": {
      "description": "UUID of the (inventory) location record",
      "$ref": "../../common/schemas/uuid.json"
    },
    "poLineId": {
      "description": "UUID of the purchase order line this record is associated with",
      "$ref": "../../common/schemas/uuid.json"
    },
    "titleId": {
      "description": "UUID of the title record",
      "$ref": "../../common/schemas/uuid.json"
    },
    "holdingId": {
      "description": "UUID of the holding record",
      "$ref": "../../common/schemas/uuid.json"
    },
    "displayOnHolding": {
      "description": "Whether or not receiving history should be displayed in holding record view",
      "type": "boolean",
      "default": false
    },
    "enumeration": {
      "type": "string",
      "description": "Enumeration is the descriptive information for the numbering scheme of a serial. Synchronized with inventory item."
    },
    "chronology": {
      "type": "string",
      "description": "Chronology is the descriptive information for the dating scheme of a serial. Synchronized with inventory item."
    },
    "discoverySuppress": {
      "type": "boolean",
      "description": "Records the fact that the record should not be displayed in a discovery system"
    },
    "copyNumber": {
      "type": "string",
      "description": "Copy number of the piece"
    },
    "receivingStatus": {
      "description": "the status of this piece",
      "type": "string",
      "enum": [
        "Received",
        "Expected"
      ],
      "default": "Expected"
    },
    "supplement": {
      "description": "Whether or not this is supplementary material",
      "type": "boolean"
    },
    "receiptDate": {
      "description": "Date that associated item is expected to arrive",
      "type": "string",
      "format": "date-time"
    },
    "receivedDate": {
      "description": "The date associated item is actually received",
      "type": "string",
      "format": "date-time"
    }
  },
  "additionalProperties": false,
  "required": [
    "format",
    "poLineId",
    "titleId",
    "receivingStatus"
  ]
}
get_pieces(**kwargs)

Retrieve a list of piece items.

GET /orders/pieces

Parameters

**kwargs (properties) – Keyword Arguments

Keyword Arguments
  • 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

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

    using CQL (indexes for piece records)

    Example

    • (username==”ab*” or personal.firstName==”ab*” or personal.lastName==”ab*”) and active==”true” sortby personal.lastName personal.firstName barcode

    • format==”Physical”

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 piece records",
  "type": "object",
  "properties": {
    "pieces": {
      "description": "collection of piece records",
      "type": "array",
      "id": "pieces",
      "items": {
        "type": "object",
        "$ref": "piece.json"
      }
    },
    "totalRecords": {
      "description": "The number of objects contained in this collection",
      "type": "integer"
    }
  },
  "additionalProperties": false
}
modify_piece(piecesId: str, piece: dict)

Update a piece record with given {id}

PUT /orders/pieces/{piecesId}

Parameters
  • piecesId (str) –

  • piece (dict) – See Schema below

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestError – Bad Request

  • OkapiFatalError – Server Error

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Piece details",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of this piece record",
      "$ref": "../../common/schemas/uuid.json"
    },
    "caption": {
      "description": "Volume/enumeration information",
      "type": "string"
    },
    "comment": {
      "description": "Free form commentary",
      "type": "string"
    },
    "format": {
      "description": "The format of the piece",
      "type": "string",
      "$ref": "piece_format.json"
    },
    "itemId": {
      "description": "UUID of the associated item record",
      "$ref": "../../common/schemas/uuid.json"
    },
    "locationId": {
      "description": "UUID of the (inventory) location record",
      "$ref": "../../common/schemas/uuid.json"
    },
    "poLineId": {
      "description": "UUID of the purchase order line this record is associated with",
      "$ref": "../../common/schemas/uuid.json"
    },
    "titleId": {
      "description": "UUID of the title record",
      "$ref": "../../common/schemas/uuid.json"
    },
    "holdingId": {
      "description": "UUID of the holding record",
      "$ref": "../../common/schemas/uuid.json"
    },
    "displayOnHolding": {
      "description": "Whether or not receiving history should be displayed in holding record view",
      "type": "boolean",
      "default": false
    },
    "enumeration": {
      "type": "string",
      "description": "Enumeration is the descriptive information for the numbering scheme of a serial. Synchronized with inventory item."
    },
    "chronology": {
      "type": "string",
      "description": "Chronology is the descriptive information for the dating scheme of a serial. Synchronized with inventory item."
    },
    "discoverySuppress": {
      "type": "boolean",
      "description": "Records the fact that the record should not be displayed in a discovery system"
    },
    "copyNumber": {
      "type": "string",
      "description": "Copy number of the piece"
    },
    "receivingStatus": {
      "description": "the status of this piece",
      "type": "string",
      "enum": [
        "Received",
        "Expected"
      ],
      "default": "Expected"
    },
    "supplement": {
      "description": "Whether or not this is supplementary material",
      "type": "boolean"
    },
    "receiptDate": {
      "description": "Date that associated item is expected to arrive",
      "type": "string",
      "format": "date-time"
    },
    "receivedDate": {
      "description": "The date associated item is actually received",
      "type": "string",
      "format": "date-time"
    }
  },
  "additionalProperties": false,
  "required": [
    "format",
    "poLineId",
    "titleId",
    "receivingStatus"
  ]
}
set_piece(piece: dict)

Create piece record

POST /orders/pieces

Parameters

piece (dict) – See Schema below

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnauthorized – Authentication is required

  • OkapiFatalError – Server Error

Headers

  • Location - URI to the created piece item

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Piece details",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of this piece record",
      "$ref": "../../common/schemas/uuid.json"
    },
    "caption": {
      "description": "Volume/enumeration information",
      "type": "string"
    },
    "comment": {
      "description": "Free form commentary",
      "type": "string"
    },
    "format": {
      "description": "The format of the piece",
      "type": "string",
      "$ref": "piece_format.json"
    },
    "itemId": {
      "description": "UUID of the associated item record",
      "$ref": "../../common/schemas/uuid.json"
    },
    "locationId": {
      "description": "UUID of the (inventory) location record",
      "$ref": "../../common/schemas/uuid.json"
    },
    "poLineId": {
      "description": "UUID of the purchase order line this record is associated with",
      "$ref": "../../common/schemas/uuid.json"
    },
    "titleId": {
      "description": "UUID of the title record",
      "$ref": "../../common/schemas/uuid.json"
    },
    "holdingId": {
      "description": "UUID of the holding record",
      "$ref": "../../common/schemas/uuid.json"
    },
    "displayOnHolding": {
      "description": "Whether or not receiving history should be displayed in holding record view",
      "type": "boolean",
      "default": false
    },
    "enumeration": {
      "type": "string",
      "description": "Enumeration is the descriptive information for the numbering scheme of a serial. Synchronized with inventory item."
    },
    "chronology": {
      "type": "string",
      "description": "Chronology is the descriptive information for the dating scheme of a serial. Synchronized with inventory item."
    },
    "discoverySuppress": {
      "type": "boolean",
      "description": "Records the fact that the record should not be displayed in a discovery system"
    },
    "copyNumber": {
      "type": "string",
      "description": "Copy number of the piece"
    },
    "receivingStatus": {
      "description": "the status of this piece",
      "type": "string",
      "enum": [
        "Received",
        "Expected"
      ],
      "default": "Expected"
    },
    "supplement": {
      "description": "Whether or not this is supplementary material",
      "type": "boolean"
    },
    "receiptDate": {
      "description": "Date that associated item is expected to arrive",
      "type": "string",
      "format": "date-time"
    },
    "receivedDate": {
      "description": "The date associated item is actually received",
      "type": "string",
      "format": "date-time"
    }
  },
  "additionalProperties": false,
  "required": [
    "format",
    "poLineId",
    "titleId",
    "receivingStatus"
  ]
}