foliolib.folio.api.inventoryStorage.InstanceType

class foliolib.folio.api.inventoryStorage.InstanceType(tenant: str)

Bases: foliolib.folio.FolioApi

Instance Types API

This documents the API calls that can be made to query and manage instance resource types

Base class of the Folio API

Parameters

tenant (str) – Tenant id

Methods

delete_instanceType(instanceTypeId)

Delete instanceType item with given {instanceTypeId}

get_instanceType(instanceTypeId)

Retrieve instanceType item with given {instanceTypeId}

get_instanceTypes(**kwargs)

Return a list of instance types

modify_instanceType(instanceTypeId, instanceType)

Update instanceType item with given {instanceTypeId}

set_instanceType(instanceType)

Create a new instance type

delete_instanceType(instanceTypeId: str)

Delete instanceType item with given {instanceTypeId}

DELETE /instance-types/{instanceTypeId}

Parameters

instanceTypeId (str) –

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestError – Bad Request

  • OkapiRequestFatalError – Server Error

get_instanceType(instanceTypeId: str)

Retrieve instanceType item with given {instanceTypeId}

GET /instance-types/{instanceTypeId}

Parameters

instanceTypeId (str) –

Returns

See Schema below

Return type

dict

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestFatalError – Server Error

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "The resource type of an Instance",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "description": "label for the resource type",
      "type": "string"
    },
    "code": {
      "description": "distinct code for the resource type",
      "type": "string"
    },
    "source": {
      "description": "origin of a resource type record",
      "source": "string"
    },
    "metadata": {
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "required": [
    "name",
    "code",
    "source"
  ]
}
get_instanceTypes(**kwargs)

Return a list of instance types

GET /instance-types

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

  • 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

  • OkapiRequestFatalError – Server Error

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A collection of Instance resource types (controlled vocabulary)",
  "type": "object",
  "properties": {
    "instanceTypes": {
      "description": "List of instance types",
      "id": "instanceType",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "instancetype.json"
      }
    },
    "totalRecords": {
      "description": "Estimated or exact total number of records",
      "type": "integer"
    }
  },
  "required": [
    "instanceTypes",
    "totalRecords"
  ]
}
modify_instanceType(instanceTypeId: str, instanceType: dict)

Update instanceType item with given {instanceTypeId}

PUT /instance-types/{instanceTypeId}

Parameters
  • instanceTypeId (str) –

  • instanceType (dict) – See Schema below

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestError – Bad Request

  • OkapiRequestConflict – Conflict

  • OkapiRequestFatalError – Server Error

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "The resource type of an Instance",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "description": "label for the resource type",
      "type": "string"
    },
    "code": {
      "description": "distinct code for the resource type",
      "type": "string"
    },
    "source": {
      "description": "origin of a resource type record",
      "source": "string"
    },
    "metadata": {
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "required": [
    "name",
    "code",
    "source"
  ]
}
set_instanceType(instanceType: dict)

Create a new instance type

POST /instance-types

Parameters

instanceType (dict) – See Schema below

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnauthorized – Authentication is required

  • OkapiRequestFatalError – Server Error

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Headers

  • Location - URI to the created instanceType item

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "The resource type of an Instance",
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "description": "label for the resource type",
      "type": "string"
    },
    "code": {
      "description": "distinct code for the resource type",
      "type": "string"
    },
    "source": {
      "description": "origin of a resource type record",
      "source": "string"
    },
    "metadata": {
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "required": [
    "name",
    "code",
    "source"
  ]
}