foliolib.folio.api.sourceRecordStorage.SourceRecordStorageRecords

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

Bases: foliolib.folio.FolioApi

Source Record Storage Record API

API for managing records

Parameters
  • tenant (str) – Tenant id

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

Methods

delete_record(recordsId)

Delete record item with given {recordId}

get_formatted_by_record(recordsId, **kwargs)

Get Record with formatted content

get_record(recordsId)

Retrieve record item with given {recordId}

get_records(**kwargs)

Retrieve a list of record items.

modify_record(recordsId, record)

Update record item with given {recordId}

modify_suppressFromDiscovery(recordsId, **kwargs)

Update Record suppress from discovery additional information

set_record(record)

Create a new record item.

delete_record(recordsId: str)

Delete record item with given {recordId}

DELETE /source-storage/records/{recordsId}

Parameters

recordsId (str) –

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestError – Bad Request

  • OkapiFatalError – Server Error

get_formatted_by_record(recordsId: str, **kwargs)

Get Record with formatted content

GET /source-storage/records/{recordsId}/formatted

Parameters
  • recordsId (str) –

  • **kwargs (properties) – Keyword Arguments

Keyword Arguments

idType (str) –

(default=RECORD) Type of Id for Record lookup

Example

  • INSTANCE

Returns

See Schema below

Return type

dict

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestNotFound – Not Found

  • OkapiFatalError – Server Error

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Record DTO Schema",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "id": {
      "description": "UUID",
      "$ref": "../../raml-util/schemas/uuid.schema"
    },
    "snapshotId": {
      "description": "Corresponding snapshot id, which is the same as jobExecutionId",
      "$ref": "../../raml-util/schemas/uuid.schema"
    },
    "matchedId": {
      "description": "Represents relations with another matched records, necessary for saving the history of applying changes for inventory/holding/etc records",
      "$ref": "../../raml-util/schemas/uuid.schema"
    },
    "generation": {
      "description": "Generation from the last record with the same matchedId incremented by 1. Starts from 0.",
      "type": "integer"
    },
    "recordType": {
      "description": "Type of record, e.g. MARC",
      "type": "string",
      "$ref": "../mod-source-record-storage/recordType.json"
    },
    "rawRecord": {
      "description": "Raw record",
      "type": "object",
      "$ref": "../mod-source-record-storage/rawRecord.json"
    },
    "parsedRecord": {
      "description": "Parsed record",
      "type": "object",
      "$ref": "../mod-source-record-storage/parsedRecord.json"
    },
    "errorRecord": {
      "description": "Error record",
      "type": "object",
      "$ref": "../mod-source-record-storage/errorRecord.json"
    },
    "deleted": {
      "description": "Flag indicates that the record marked as deleted",
      "type": "boolean",
      "default": false
    },
    "order": {
      "description": "Order of the record in imported file",
      "type": "integer",
      "minimum": 0
    },
    "externalIdsHolder": {
      "description": "Container for identifiers of external entities",
      "type": "object",
      "$ref": "../common/externalIdsHolder.json"
    },
    "additionalInfo": {
      "description": "Auxiliary data which is not related to MARC type record",
      "type": "object",
      "$ref": "../mod-source-record-storage/additionalInfo.json"
    },
    "state": {
      "description": "This field represents the actual state of a particular SRS record. Can be: ACTUAL, OLD, DRAFT, DELETED. ",
      "type": "string",
      "enum": [
        "ACTUAL",
        "OLD",
        "DRAFT",
        "DELETED"
      ],
      "default": "ACTUAL"
    },
    "leaderRecordStatus": {
      "description": "Single character representing MARC leader 05",
      "type": "string",
      "pattern": "^[a|c|d|n|p|o|s|x]{1}$"
    },
    "metadata": {
      "description": "Metadata provided by the server",
      "type": "object",
      "$ref": "../../raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "required": [
    "snapshotId",
    "matchedId",
    "recordType",
    "rawRecord"
  ]
}
get_record(recordsId: str)

Retrieve record item with given {recordId}

GET /source-storage/records/{recordsId}

Parameters

recordsId (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": "Record DTO Schema",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "id": {
      "description": "UUID",
      "$ref": "../../raml-util/schemas/uuid.schema"
    },
    "snapshotId": {
      "description": "Corresponding snapshot id, which is the same as jobExecutionId",
      "$ref": "../../raml-util/schemas/uuid.schema"
    },
    "matchedId": {
      "description": "Represents relations with another matched records, necessary for saving the history of applying changes for inventory/holding/etc records",
      "$ref": "../../raml-util/schemas/uuid.schema"
    },
    "generation": {
      "description": "Generation from the last record with the same matchedId incremented by 1. Starts from 0.",
      "type": "integer"
    },
    "recordType": {
      "description": "Type of record, e.g. MARC",
      "type": "string",
      "$ref": "../mod-source-record-storage/recordType.json"
    },
    "rawRecord": {
      "description": "Raw record",
      "type": "object",
      "$ref": "../mod-source-record-storage/rawRecord.json"
    },
    "parsedRecord": {
      "description": "Parsed record",
      "type": "object",
      "$ref": "../mod-source-record-storage/parsedRecord.json"
    },
    "errorRecord": {
      "description": "Error record",
      "type": "object",
      "$ref": "../mod-source-record-storage/errorRecord.json"
    },
    "deleted": {
      "description": "Flag indicates that the record marked as deleted",
      "type": "boolean",
      "default": false
    },
    "order": {
      "description": "Order of the record in imported file",
      "type": "integer",
      "minimum": 0
    },
    "externalIdsHolder": {
      "description": "Container for identifiers of external entities",
      "type": "object",
      "$ref": "../common/externalIdsHolder.json"
    },
    "additionalInfo": {
      "description": "Auxiliary data which is not related to MARC type record",
      "type": "object",
      "$ref": "../mod-source-record-storage/additionalInfo.json"
    },
    "state": {
      "description": "This field represents the actual state of a particular SRS record. Can be: ACTUAL, OLD, DRAFT, DELETED. ",
      "type": "string",
      "enum": [
        "ACTUAL",
        "OLD",
        "DRAFT",
        "DELETED"
      ],
      "default": "ACTUAL"
    },
    "leaderRecordStatus": {
      "description": "Single character representing MARC leader 05",
      "type": "string",
      "pattern": "^[a|c|d|n|p|o|s|x]{1}$"
    },
    "metadata": {
      "description": "Metadata provided by the server",
      "type": "object",
      "$ref": "../../raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "required": [
    "snapshotId",
    "matchedId",
    "recordType",
    "rawRecord"
  ]
}
get_records(**kwargs)

Retrieve a list of record items.

GET /source-storage/records

Parameters

**kwargs (properties) – Keyword Arguments

Keyword Arguments
  • 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

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Collection of record DTO",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "records": {
      "description": "List of records",
      "type": "array",
      "id": "recordList",
      "items": {
        "type": "object",
        "$ref": "record.json"
      }
    },
    "totalRecords": {
      "description": "Total number of records",
      "type": "integer"
    }
  },
  "excludedFromEqualsAndHashCode": [
    "totalRecords"
  ],
  "required": [
    "records",
    "totalRecords"
  ]
}
modify_record(recordsId: str, record: dict)

Update record item with given {recordId}

PUT /source-storage/records/{recordsId}

Parameters
  • recordsId (str) –

  • record (dict) – See Schema below

Raises
  • OkapiRequestNotFound – Not Found

  • OkapiRequestError – Bad Request

  • OkapiRequestConflict – Conflict

  • OkapiFatalError – Server Error

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Record DTO Schema",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "id": {
      "description": "UUID",
      "$ref": "../../raml-util/schemas/uuid.schema"
    },
    "snapshotId": {
      "description": "Corresponding snapshot id, which is the same as jobExecutionId",
      "$ref": "../../raml-util/schemas/uuid.schema"
    },
    "matchedId": {
      "description": "Represents relations with another matched records, necessary for saving the history of applying changes for inventory/holding/etc records",
      "$ref": "../../raml-util/schemas/uuid.schema"
    },
    "generation": {
      "description": "Generation from the last record with the same matchedId incremented by 1. Starts from 0.",
      "type": "integer"
    },
    "recordType": {
      "description": "Type of record, e.g. MARC",
      "type": "string",
      "$ref": "../mod-source-record-storage/recordType.json"
    },
    "rawRecord": {
      "description": "Raw record",
      "type": "object",
      "$ref": "../mod-source-record-storage/rawRecord.json"
    },
    "parsedRecord": {
      "description": "Parsed record",
      "type": "object",
      "$ref": "../mod-source-record-storage/parsedRecord.json"
    },
    "errorRecord": {
      "description": "Error record",
      "type": "object",
      "$ref": "../mod-source-record-storage/errorRecord.json"
    },
    "deleted": {
      "description": "Flag indicates that the record marked as deleted",
      "type": "boolean",
      "default": false
    },
    "order": {
      "description": "Order of the record in imported file",
      "type": "integer",
      "minimum": 0
    },
    "externalIdsHolder": {
      "description": "Container for identifiers of external entities",
      "type": "object",
      "$ref": "../common/externalIdsHolder.json"
    },
    "additionalInfo": {
      "description": "Auxiliary data which is not related to MARC type record",
      "type": "object",
      "$ref": "../mod-source-record-storage/additionalInfo.json"
    },
    "state": {
      "description": "This field represents the actual state of a particular SRS record. Can be: ACTUAL, OLD, DRAFT, DELETED. ",
      "type": "string",
      "enum": [
        "ACTUAL",
        "OLD",
        "DRAFT",
        "DELETED"
      ],
      "default": "ACTUAL"
    },
    "leaderRecordStatus": {
      "description": "Single character representing MARC leader 05",
      "type": "string",
      "pattern": "^[a|c|d|n|p|o|s|x]{1}$"
    },
    "metadata": {
      "description": "Metadata provided by the server",
      "type": "object",
      "$ref": "../../raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "required": [
    "snapshotId",
    "matchedId",
    "recordType",
    "rawRecord"
  ]
}
modify_suppressFromDiscovery(recordsId: str, **kwargs)

Update Record suppress from discovery additional information

PUT /source-storage/records/{recordsId}/suppress-from-discovery

Parameters
  • recordsId (str) –

  • **kwargs (properties) – Keyword Arguments

Keyword Arguments
  • idType (str) –

    (default=RECORD) Type of Id for Record lookup

    Example

    • INSTANCE

  • suppress (bool) –

    (default=True) Whether to suppress or unsuppress from discovery

    Example

    • False

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

  • OkapiFatalError – Server Error

set_record(record: dict)

Create a new record item.

POST /source-storage/records

Parameters

record (dict) – See Schema below

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnauthorized – Authentication is required

  • OkapiFatalError – Server Error

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Headers

  • Location - URI to the created record item

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Record DTO Schema",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "id": {
      "description": "UUID",
      "$ref": "../../raml-util/schemas/uuid.schema"
    },
    "snapshotId": {
      "description": "Corresponding snapshot id, which is the same as jobExecutionId",
      "$ref": "../../raml-util/schemas/uuid.schema"
    },
    "matchedId": {
      "description": "Represents relations with another matched records, necessary for saving the history of applying changes for inventory/holding/etc records",
      "$ref": "../../raml-util/schemas/uuid.schema"
    },
    "generation": {
      "description": "Generation from the last record with the same matchedId incremented by 1. Starts from 0.",
      "type": "integer"
    },
    "recordType": {
      "description": "Type of record, e.g. MARC",
      "type": "string",
      "$ref": "../mod-source-record-storage/recordType.json"
    },
    "rawRecord": {
      "description": "Raw record",
      "type": "object",
      "$ref": "../mod-source-record-storage/rawRecord.json"
    },
    "parsedRecord": {
      "description": "Parsed record",
      "type": "object",
      "$ref": "../mod-source-record-storage/parsedRecord.json"
    },
    "errorRecord": {
      "description": "Error record",
      "type": "object",
      "$ref": "../mod-source-record-storage/errorRecord.json"
    },
    "deleted": {
      "description": "Flag indicates that the record marked as deleted",
      "type": "boolean",
      "default": false
    },
    "order": {
      "description": "Order of the record in imported file",
      "type": "integer",
      "minimum": 0
    },
    "externalIdsHolder": {
      "description": "Container for identifiers of external entities",
      "type": "object",
      "$ref": "../common/externalIdsHolder.json"
    },
    "additionalInfo": {
      "description": "Auxiliary data which is not related to MARC type record",
      "type": "object",
      "$ref": "../mod-source-record-storage/additionalInfo.json"
    },
    "state": {
      "description": "This field represents the actual state of a particular SRS record. Can be: ACTUAL, OLD, DRAFT, DELETED. ",
      "type": "string",
      "enum": [
        "ACTUAL",
        "OLD",
        "DRAFT",
        "DELETED"
      ],
      "default": "ACTUAL"
    },
    "leaderRecordStatus": {
      "description": "Single character representing MARC leader 05",
      "type": "string",
      "pattern": "^[a|c|d|n|p|o|s|x]{1}$"
    },
    "metadata": {
      "description": "Metadata provided by the server",
      "type": "object",
      "$ref": "../../raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "required": [
    "snapshotId",
    "matchedId",
    "recordType",
    "rawRecord"
  ]
}