foliolib.folio.api.inventoryStorage.StatisticalCode

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

Bases: foliolib.folio.FolioApi

Statistical code reference API

This documents the API calls that can be made to query and manage statistical codes of the system

Parameters
  • tenant (str) – Tenant id

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

Methods

delete_statisticalCode(statisticalCodeId)

Delete statisticalCode item with given {statisticalCodeId}

get_statisticalCode(statisticalCodeId)

Retrieve statisticalCode item with given {statisticalCodeId}

get_statisticalCodes(**kwargs)

Return a list of statistical codes

modify_statisticalCode(statisticalCodeId, ...)

Update statisticalCode item with given {statisticalCodeId}

set_statisticalCode(statisticalCode)

Create a new statistical code

delete_statisticalCode(statisticalCodeId: str)

Delete statisticalCode item with given {statisticalCodeId}

DELETE /statistical-codes/{statisticalCodeId}

Parameters

statisticalCodeId (str) –

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestError – Bad Request

  • OkapiFatalError – Server Error

get_statisticalCode(statisticalCodeId: str)

Retrieve statisticalCode item with given {statisticalCodeId}

GET /statistical-codes/{statisticalCodeId}

Parameters

statisticalCodeId (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": "A statistical code",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "unique ID of the statistical code; a UUID"
    },
    "code": {
      "type": "string",
      "description": "statistical code; a distinct label"
    },
    "name": {
      "type": "string",
      "description": "name or description of a statistical code"
    },
    "statisticalCodeTypeId": {
      "type": "string",
      "description": "a UUID referencing a statistical code type"
    },
    "source": {
      "source": "string",
      "description": "label indicating where the statistical code originates from, i.e. 'folio' or 'local'"
    },
    "metadata": {
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "code",
    "name",
    "statisticalCodeTypeId",
    "source"
  ]
}
get_statisticalCodes(**kwargs)

Return a list of statistical codes

GET /statistical-codes

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

    Example

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

    • name=aaa

  • 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": "A collection of statistical codes",
  "type": "object",
  "properties": {
    "statisticalCodes": {
      "description": "List of statistical codes",
      "id": "statisticalCode",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "statisticalcode.json"
      }
    },
    "totalRecords": {
      "description": "Estimated or exact total number of records",
      "type": "integer"
    }
  },
  "required": [
    "statisticalCode",
    "totalRecords"
  ]
}
modify_statisticalCode(statisticalCodeId: str, statisticalCode: dict)

Update statisticalCode item with given {statisticalCodeId}

PUT /statistical-codes/{statisticalCodeId}

Parameters
  • statisticalCodeId (str) –

  • statisticalCode (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": "A statistical code",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "unique ID of the statistical code; a UUID"
    },
    "code": {
      "type": "string",
      "description": "statistical code; a distinct label"
    },
    "name": {
      "type": "string",
      "description": "name or description of a statistical code"
    },
    "statisticalCodeTypeId": {
      "type": "string",
      "description": "a UUID referencing a statistical code type"
    },
    "source": {
      "source": "string",
      "description": "label indicating where the statistical code originates from, i.e. 'folio' or 'local'"
    },
    "metadata": {
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "code",
    "name",
    "statisticalCodeTypeId",
    "source"
  ]
}
set_statisticalCode(statisticalCode: dict)

Create a new statistical code

POST /statistical-codes

Parameters

statisticalCode (dict) – See Schema below

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnauthorized – Authentication is required

  • OkapiFatalError – Server Error

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Headers

  • Location - URI to the created statisticalCode item

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A statistical code",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "description": "unique ID of the statistical code; a UUID"
    },
    "code": {
      "type": "string",
      "description": "statistical code; a distinct label"
    },
    "name": {
      "type": "string",
      "description": "name or description of a statistical code"
    },
    "statisticalCodeTypeId": {
      "type": "string",
      "description": "a UUID referencing a statistical code type"
    },
    "source": {
      "source": "string",
      "description": "label indicating where the statistical code originates from, i.e. 'folio' or 'local'"
    },
    "metadata": {
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "code",
    "name",
    "statisticalCodeTypeId",
    "source"
  ]
}