foliolib.folio.api.inventoryStorage.Location

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

Bases: foliolib.folio.FolioApi

Locations API

This documents the API calls that can be made to query and manage (shelf) locations of the system

Base class of the Folio API

Parameters

tenant (str) – Tenant id

Methods

delete_location(locationsId)

Delete location item with given {locationId}

delete_locations()

DELETE /locations

get_location(locationsId)

Retrieve location item with given {locationId}

get_locations(**kwargs)

Return a list of locations

modify_location(locationsId, location)

Update a location by id

set_location(location)

Create a new location

delete_location(locationsId: str)

Delete location item with given {locationId}

DELETE /locations/{locationsId}

Parameters

locationsId (str) –

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestError – Bad Request

  • OkapiRequestFatalError – Server Error

delete_locations()

DELETE /locations

get_location(locationsId: str)

Retrieve location item with given {locationId}

GET /locations/{locationsId}

Parameters

locationsId (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": "A (shelf) location, the forth-level location unit below institution, campus, and library.",
  "javaType": "org.folio.rest.jaxrs.model.Location",
  "type": "object",
  "properties": {
    "id": {
      "description": "id of this (shelf) location record as UUID.",
      "type": "string"
    },
    "name": {
      "description": "Name of the (shelf) location",
      "type": "string"
    },
    "code": {
      "description": "Code of the (shelf) location, usually an abbreviation of the name.",
      "type": "string"
    },
    "description": {
      "description": "Description of the (shelf) location.",
      "type": "string"
    },
    "discoveryDisplayName": {
      "description": "Name of the (shelf) location to be shown in the discovery.",
      "type": "string"
    },
    "isActive": {
      "description": "Whether this (shelf) location is active. Inactive (shelf) locations can no longer been used.",
      "type": "boolean"
    },
    "institutionId": {
      "description": "The UUID of the institution, the first-level location unit, this (shelf) location belongs to.",
      "type": "string"
    },
    "institution": {
      "description": "The institution, the first-level location unit, this (shelf) location belongs to.",
      "type": "object",
      "folio:$ref": "locinst.json",
      "readonly": true,
      "folio:isVirtual": true,
      "folio:linkBase": "location-units/institutions",
      "folio:linkFromField": "institutionId",
      "folio:linkToField": "id",
      "folio:includedElement": "locinsts.0"
    },
    "campusId": {
      "description": "The UUID of the campus, the second-level location unit, this (shelf) location belongs to.",
      "type": "string"
    },
    "campus": {
      "description": "The campus, the second-level location unit, this (shelf) location belongs to",
      "type": "object",
      "folio:$ref": "loccamp.json",
      "readonly": true,
      "folio:isVirtual": true,
      "folio:linkBase": "location-units/campuses",
      "folio:linkFromField": "campusId",
      "folio:linkToField": "id",
      "folio:includedElement": "loccamps.0"
    },
    "libraryId": {
      "description": "The UUID of the library, the third-level location unit, this (shelf) location belongs to.",
      "type": "string"
    },
    "library": {
      "description": "The library, the third-level location unit, this (shelf) location belongs to.",
      "type": "object",
      "folio:$ref": "locinst.json",
      "readonly": true,
      "folio:isVirtual": true,
      "folio:linkBase": "location-units/libraries",
      "folio:linkFromField": "libraryId",
      "folio:linkToField": "id",
      "folio:includedElement": "loclibs.0"
    },
    "details": {
      "description": "Details about this (shelf) location.",
      "type": "object"
    },
    "primaryServicePoint": {
      "description": "The UUID of the primary service point of this (shelf) location.",
      "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$",
      "type": "string"
    },
    "primaryServicePointObject": {
      "type": "object",
      "description": "Dereferenced object for primary service point. This should really just be called 'primaryServicePoint', but the field containing the ID of this object has that name -- it should really be called 'primaryServicePointId' -- so we need something different for this one.",
      "$ref": "servicepoint.json",
      "readonly": true,
      "folio:isVirtual": true,
      "folio:linkBase": "service-points",
      "folio:linkFromField": "primaryServicePoint",
      "folio:linkToField": "id",
      "folio:includedElement": "servicepoints.0"
    },
    "servicePointIds": {
      "description": "All service points that this (shelf) location has.",
      "type": "array",
      "items": {
        "description": "The UUID of a service point that belongs to this (shelf) location.",
        "type": "string",
        "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$",
        "not": {
          "type": "null"
        }
      }
    },
    "servicePoints": {
      "type": "array",
      "description": "List of dereferenced service points",
      "items": {
        "type": "object",
        "$ref": "servicepoint.json"
      },
      "readonly": true,
      "folio:isVirtual": true,
      "folio:linkBase": "service-points",
      "folio:linkFromField": "servicePointIds",
      "folio:linkToField": "id",
      "folio:includedElement": "servicepoints"
    },
    "metadata": {
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "name",
    "code",
    "institutionId",
    "campusId",
    "libraryId",
    "primaryServicePoint"
  ]
}
get_locations(**kwargs)

Return a list of locations

GET /locations

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": "List of (shelf) locations.",
  "type": "object",
  "properties": {
    "locations": {
      "id": "locations",
      "description": "List of (shelf) locations.",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "location.json"
      }
    },
    "totalRecords": {
      "description": "Estimated or exact total number of records",
      "type": "integer"
    }
  },
  "required": [
    "locations",
    "totalRecords"
  ]
}
modify_location(locationsId: str, location: dict)

Update a location by id

PUT /locations/{locationsId}

Parameters
  • locationsId (str) –

  • location (dict) – See Schema below

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestError – Bad Request

  • OkapiRequestConflict – Conflict

  • OkapiRequestFatalError – Server Error

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A (shelf) location, the forth-level location unit below institution, campus, and library.",
  "javaType": "org.folio.rest.jaxrs.model.Location",
  "type": "object",
  "properties": {
    "id": {
      "description": "id of this (shelf) location record as UUID.",
      "type": "string"
    },
    "name": {
      "description": "Name of the (shelf) location",
      "type": "string"
    },
    "code": {
      "description": "Code of the (shelf) location, usually an abbreviation of the name.",
      "type": "string"
    },
    "description": {
      "description": "Description of the (shelf) location.",
      "type": "string"
    },
    "discoveryDisplayName": {
      "description": "Name of the (shelf) location to be shown in the discovery.",
      "type": "string"
    },
    "isActive": {
      "description": "Whether this (shelf) location is active. Inactive (shelf) locations can no longer been used.",
      "type": "boolean"
    },
    "institutionId": {
      "description": "The UUID of the institution, the first-level location unit, this (shelf) location belongs to.",
      "type": "string"
    },
    "institution": {
      "description": "The institution, the first-level location unit, this (shelf) location belongs to.",
      "type": "object",
      "folio:$ref": "locinst.json",
      "readonly": true,
      "folio:isVirtual": true,
      "folio:linkBase": "location-units/institutions",
      "folio:linkFromField": "institutionId",
      "folio:linkToField": "id",
      "folio:includedElement": "locinsts.0"
    },
    "campusId": {
      "description": "The UUID of the campus, the second-level location unit, this (shelf) location belongs to.",
      "type": "string"
    },
    "campus": {
      "description": "The campus, the second-level location unit, this (shelf) location belongs to",
      "type": "object",
      "folio:$ref": "loccamp.json",
      "readonly": true,
      "folio:isVirtual": true,
      "folio:linkBase": "location-units/campuses",
      "folio:linkFromField": "campusId",
      "folio:linkToField": "id",
      "folio:includedElement": "loccamps.0"
    },
    "libraryId": {
      "description": "The UUID of the library, the third-level location unit, this (shelf) location belongs to.",
      "type": "string"
    },
    "library": {
      "description": "The library, the third-level location unit, this (shelf) location belongs to.",
      "type": "object",
      "folio:$ref": "locinst.json",
      "readonly": true,
      "folio:isVirtual": true,
      "folio:linkBase": "location-units/libraries",
      "folio:linkFromField": "libraryId",
      "folio:linkToField": "id",
      "folio:includedElement": "loclibs.0"
    },
    "details": {
      "description": "Details about this (shelf) location.",
      "type": "object"
    },
    "primaryServicePoint": {
      "description": "The UUID of the primary service point of this (shelf) location.",
      "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$",
      "type": "string"
    },
    "primaryServicePointObject": {
      "type": "object",
      "description": "Dereferenced object for primary service point. This should really just be called 'primaryServicePoint', but the field containing the ID of this object has that name -- it should really be called 'primaryServicePointId' -- so we need something different for this one.",
      "$ref": "servicepoint.json",
      "readonly": true,
      "folio:isVirtual": true,
      "folio:linkBase": "service-points",
      "folio:linkFromField": "primaryServicePoint",
      "folio:linkToField": "id",
      "folio:includedElement": "servicepoints.0"
    },
    "servicePointIds": {
      "description": "All service points that this (shelf) location has.",
      "type": "array",
      "items": {
        "description": "The UUID of a service point that belongs to this (shelf) location.",
        "type": "string",
        "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$",
        "not": {
          "type": "null"
        }
      }
    },
    "servicePoints": {
      "type": "array",
      "description": "List of dereferenced service points",
      "items": {
        "type": "object",
        "$ref": "servicepoint.json"
      },
      "readonly": true,
      "folio:isVirtual": true,
      "folio:linkBase": "service-points",
      "folio:linkFromField": "servicePointIds",
      "folio:linkToField": "id",
      "folio:includedElement": "servicepoints"
    },
    "metadata": {
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "name",
    "code",
    "institutionId",
    "campusId",
    "libraryId",
    "primaryServicePoint"
  ]
}
set_location(location: dict)

Create a new location

POST /locations

Parameters

location (dict) – See Schema below

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnauthorized – Authentication is required

  • OkapiRequestFatalError – Server Error

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Headers

  • Location - URI to the created location item

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A (shelf) location, the forth-level location unit below institution, campus, and library.",
  "javaType": "org.folio.rest.jaxrs.model.Location",
  "type": "object",
  "properties": {
    "id": {
      "description": "id of this (shelf) location record as UUID.",
      "type": "string"
    },
    "name": {
      "description": "Name of the (shelf) location",
      "type": "string"
    },
    "code": {
      "description": "Code of the (shelf) location, usually an abbreviation of the name.",
      "type": "string"
    },
    "description": {
      "description": "Description of the (shelf) location.",
      "type": "string"
    },
    "discoveryDisplayName": {
      "description": "Name of the (shelf) location to be shown in the discovery.",
      "type": "string"
    },
    "isActive": {
      "description": "Whether this (shelf) location is active. Inactive (shelf) locations can no longer been used.",
      "type": "boolean"
    },
    "institutionId": {
      "description": "The UUID of the institution, the first-level location unit, this (shelf) location belongs to.",
      "type": "string"
    },
    "institution": {
      "description": "The institution, the first-level location unit, this (shelf) location belongs to.",
      "type": "object",
      "folio:$ref": "locinst.json",
      "readonly": true,
      "folio:isVirtual": true,
      "folio:linkBase": "location-units/institutions",
      "folio:linkFromField": "institutionId",
      "folio:linkToField": "id",
      "folio:includedElement": "locinsts.0"
    },
    "campusId": {
      "description": "The UUID of the campus, the second-level location unit, this (shelf) location belongs to.",
      "type": "string"
    },
    "campus": {
      "description": "The campus, the second-level location unit, this (shelf) location belongs to",
      "type": "object",
      "folio:$ref": "loccamp.json",
      "readonly": true,
      "folio:isVirtual": true,
      "folio:linkBase": "location-units/campuses",
      "folio:linkFromField": "campusId",
      "folio:linkToField": "id",
      "folio:includedElement": "loccamps.0"
    },
    "libraryId": {
      "description": "The UUID of the library, the third-level location unit, this (shelf) location belongs to.",
      "type": "string"
    },
    "library": {
      "description": "The library, the third-level location unit, this (shelf) location belongs to.",
      "type": "object",
      "folio:$ref": "locinst.json",
      "readonly": true,
      "folio:isVirtual": true,
      "folio:linkBase": "location-units/libraries",
      "folio:linkFromField": "libraryId",
      "folio:linkToField": "id",
      "folio:includedElement": "loclibs.0"
    },
    "details": {
      "description": "Details about this (shelf) location.",
      "type": "object"
    },
    "primaryServicePoint": {
      "description": "The UUID of the primary service point of this (shelf) location.",
      "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$",
      "type": "string"
    },
    "primaryServicePointObject": {
      "type": "object",
      "description": "Dereferenced object for primary service point. This should really just be called 'primaryServicePoint', but the field containing the ID of this object has that name -- it should really be called 'primaryServicePointId' -- so we need something different for this one.",
      "$ref": "servicepoint.json",
      "readonly": true,
      "folio:isVirtual": true,
      "folio:linkBase": "service-points",
      "folio:linkFromField": "primaryServicePoint",
      "folio:linkToField": "id",
      "folio:includedElement": "servicepoints.0"
    },
    "servicePointIds": {
      "description": "All service points that this (shelf) location has.",
      "type": "array",
      "items": {
        "description": "The UUID of a service point that belongs to this (shelf) location.",
        "type": "string",
        "pattern": "^[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}$",
        "not": {
          "type": "null"
        }
      }
    },
    "servicePoints": {
      "type": "array",
      "description": "List of dereferenced service points",
      "items": {
        "type": "object",
        "$ref": "servicepoint.json"
      },
      "readonly": true,
      "folio:isVirtual": true,
      "folio:linkBase": "service-points",
      "folio:linkFromField": "servicePointIds",
      "folio:linkToField": "id",
      "folio:includedElement": "servicepoints"
    },
    "metadata": {
      "type": "object",
      "$ref": "raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "additionalProperties": false,
  "required": [
    "name",
    "code",
    "institutionId",
    "campusId",
    "libraryId",
    "primaryServicePoint"
  ]
}