foliolib.folio.api.inventoryStorage.Locationunit

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

Bases: foliolib.folio.FolioApi

Location units

This documents the API calls that can be made to query and manage location units like institutions, campuses, and libraries

Parameters
  • tenant (str) – Tenant id

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

Methods

delete_campuse(campusesId)

Delete campuse item with given {campuseId}

delete_campuses()

DELETE /location-units/campuses

delete_institution(institutionsId)

Delete institution item with given {institutionId}

delete_institutions()

DELETE /location-units/institutions

delete_libraries()

DELETE /location-units/libraries

delete_library(librariesId)

Delete library item with given {libraryId}

get_campuse(campusesId)

Retrieve campuse item with given {campuseId}

get_campuses(**kwargs)

Return a list of campuses

get_institution(institutionsId)

Retrieve institution item with given {institutionId}

get_institutions(**kwargs)

Return a list of institutions

get_libraries(**kwargs)

Return a list of libraries

get_library(librariesId)

Retrieve library item with given {libraryId}

modify_campuse(campusesId, campuse)

Update campuse item with given {campuseId}

modify_institution(institutionsId, institution)

Update institution item with given {institutionId}

modify_library(librariesId, library)

Update library item with given {libraryId}

set_campuse(campuse)

Create a new campus

set_institution(institution)

Create a new institution

set_library(library)

Create a new library

delete_campuse(campusesId: str)

Delete campuse item with given {campuseId}

DELETE /location-units/campuses/{campusesId}

Parameters

campusesId (str) –

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestError – Bad Request

  • OkapiFatalError – Server Error

delete_campuses()

DELETE /location-units/campuses

delete_institution(institutionsId: str)

Delete institution item with given {institutionId}

DELETE /location-units/institutions/{institutionsId}

Parameters

institutionsId (str) –

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestError – Bad Request

  • OkapiFatalError – Server Error

delete_institutions()

DELETE /location-units/institutions

delete_libraries()

DELETE /location-units/libraries

delete_library(librariesId: str)

Delete library item with given {libraryId}

DELETE /location-units/libraries/{librariesId}

Parameters

librariesId (str) –

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestError – Bad Request

  • OkapiFatalError – Server Error

get_campuse(campusesId: str)

Retrieve campuse item with given {campuseId}

GET /location-units/campuses/{campusesId}

Parameters

campusesId (str) –

Returns

See Schema below

Return type

dict

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiFatalError – Server Error

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "description": "second-level location unit",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "description": "name of the location",
      "type": "string"
    },
    "code": {
      "description": "distinct code for the location",
      "type": "string"
    },
    "institutionId": {
      "description": "ID of the first-level location unit that the second-level unit belongs to",
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "name",
    "institutionId",
    "code"
  ]
}
get_campuses(**kwargs)

Return a list of campuses

GET /location-units/campuses

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 second-level location units",
  "type": "object",
  "properties": {
    "loccamps": {
      "description": "List of second-level location units",
      "id": "loccamps",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "loccamp.json"
      }
    },
    "totalRecords": {
      "description": "Estimated or exact total number of records",
      "type": "integer"
    }
  },
  "required": [
    "loccamps",
    "totalRecords"
  ]
}
get_institution(institutionsId: str)

Retrieve institution item with given {institutionId}

GET /location-units/institutions/{institutionsId}

Parameters

institutionsId (str) –

Returns

See Schema below

Return type

dict

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiFatalError – Server Error

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "description": "highest-level location unit",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "description": "name of location",
      "type": "string"
    },
    "code": {
      "description": "distinct code for location",
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "name",
    "code"
  ]
}
get_institutions(**kwargs)

Return a list of institutions

GET /location-units/institutions

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 top-level location units",
  "type": "object",
  "properties": {
    "locinsts": {
      "description": "List of first-level location units",
      "id": "locinsts",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "locinst.json"
      }
    },
    "totalRecords": {
      "description": "Estimated or exact total number of records",
      "type": "integer"
    }
  },
  "required": [
    "locinsts",
    "totalRecords"
  ]
}
get_libraries(**kwargs)

Return a list of libraries

GET /location-units/libraries

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 third-level location units",
  "type": "object",
  "properties": {
    "loclibs": {
      "description": "List of third-level location units",
      "id": "loclibs",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "loclib.json"
      }
    },
    "totalRecords": {
      "description": "Estimated or exact total number of records",
      "type": "integer"
    }
  },
  "required": [
    "loclibs",
    "totalRecords"
  ]
}
get_library(librariesId: str)

Retrieve library item with given {libraryId}

GET /location-units/libraries/{librariesId}

Parameters

librariesId (str) –

Returns

See Schema below

Return type

dict

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiFatalError – Server Error

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "description": "third-level location unit",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "description": "name of the location",
      "type": "string"
    },
    "code": {
      "description": "distinct code for the location",
      "type": "string"
    },
    "campusId": {
      "description": "ID of the second-level location unit that the third-level unit belongs to",
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "name",
    "campusId",
    "code"
  ]
}
modify_campuse(campusesId: str, campuse: dict)

Update campuse item with given {campuseId}

PUT /location-units/campuses/{campusesId}

Parameters
  • campusesId (str) –

  • campuse (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#",
  "type": "object",
  "description": "second-level location unit",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "description": "name of the location",
      "type": "string"
    },
    "code": {
      "description": "distinct code for the location",
      "type": "string"
    },
    "institutionId": {
      "description": "ID of the first-level location unit that the second-level unit belongs to",
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "name",
    "institutionId",
    "code"
  ]
}
modify_institution(institutionsId: str, institution: dict)

Update institution item with given {institutionId}

PUT /location-units/institutions/{institutionsId}

Parameters
  • institutionsId (str) –

  • institution (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#",
  "type": "object",
  "description": "highest-level location unit",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "description": "name of location",
      "type": "string"
    },
    "code": {
      "description": "distinct code for location",
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "name",
    "code"
  ]
}
modify_library(librariesId: str, library: dict)

Update library item with given {libraryId}

PUT /location-units/libraries/{librariesId}

Parameters
  • librariesId (str) –

  • library (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#",
  "type": "object",
  "description": "third-level location unit",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "description": "name of the location",
      "type": "string"
    },
    "code": {
      "description": "distinct code for the location",
      "type": "string"
    },
    "campusId": {
      "description": "ID of the second-level location unit that the third-level unit belongs to",
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "name",
    "campusId",
    "code"
  ]
}
set_campuse(campuse: dict)

Create a new campus

POST /location-units/campuses

Parameters

campuse (dict) – See Schema below

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnauthorized – Authentication is required

  • OkapiFatalError – Server Error

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Headers

  • Location - URI to the created campuse item

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "description": "second-level location unit",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "description": "name of the location",
      "type": "string"
    },
    "code": {
      "description": "distinct code for the location",
      "type": "string"
    },
    "institutionId": {
      "description": "ID of the first-level location unit that the second-level unit belongs to",
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "name",
    "institutionId",
    "code"
  ]
}
set_institution(institution: dict)

Create a new institution

POST /location-units/institutions

Parameters

institution (dict) – See Schema below

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnauthorized – Authentication is required

  • OkapiFatalError – Server Error

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Headers

  • Location - URI to the created institution item

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "description": "highest-level location unit",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "description": "name of location",
      "type": "string"
    },
    "code": {
      "description": "distinct code for location",
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "name",
    "code"
  ]
}
set_library(library: dict)

Create a new library

POST /location-units/libraries

Parameters

library (dict) – See Schema below

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnauthorized – Authentication is required

  • OkapiFatalError – Server Error

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Headers

  • Location - URI to the created library item

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "type": "object",
  "description": "third-level location unit",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "description": "name of the location",
      "type": "string"
    },
    "code": {
      "description": "distinct code for the location",
      "type": "string"
    },
    "campusId": {
      "description": "ID of the second-level location unit that the third-level unit belongs to",
      "type": "string"
    },
    "metadata": {
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "name",
    "campusId",
    "code"
  ]
}