foliolib.folio.api.ordersStorage.Pieces

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

Bases: foliolib.folio.FolioApi

CRUD API to manage Pieces. This API is intended for internal use only. Please use the /orders/pieces, /orders/receiving, /orders/check-in, and /orders/receiving-history APIs provided by mod-orders instead.

Parameters
  • tenant (str) – Tenant id

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

Methods

delete_piece(piecesId)

Delete piece item with given {pieceId}

get_piece(piecesId)

Retrieve piece item with given {pieceId}

get_pieces(**kwargs)

Get list of pieces

modify_piece(piecesId, piece)

Update piece item with given {pieceId}

set_piece(piece)

Create a new piece item.

delete_piece(piecesId: str)

Delete piece item with given {pieceId}

DELETE /orders-storage/pieces/{piecesId}

Parameters

piecesId (str) –

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestError – Bad Request

  • OkapiFatalError – Server Error

get_piece(piecesId: str)

Retrieve piece item with given {pieceId}

GET /orders-storage/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)

Get list of pieces

GET /orders-storage/pieces

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 code

    Example

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

    • [“code”, “MEDGRANT”, “=”]

  • 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 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 piece item with given {pieceId}

PUT /orders-storage/pieces/{piecesId}

Parameters
  • piecesId (str) –

  • piece (dict) – See Schema below

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestError – Bad Request

  • OkapiRequestConflict – Conflict

  • 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 a new piece item.

POST /orders-storage/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"
  ]
}