foliolib.folio.api.sourceRecordStorage.SourceRecordStorageBatch

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

Bases: foliolib.folio.FolioApi

Source Record Storage Batch API

Batch API for managing records

Parameters
  • tenant (str) – Tenant id

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

Methods

modify_parsedRecord(parsedRecord)

Updates parsed records from a collection.

set_fetch(fetch)

Fetch exact fields of parsed records by external IDs.

set_record(record)

Creates records from a record collection.

set_verifiedRecord(verifiedRecord)

Get a list of invalid Marc Bib Record IDs, which doesn't exists in the system

modify_parsedRecord(parsedRecord: dict)

Updates parsed records from a collection. It returns both updated records and error messages for records that were not updated.

PUT /source-storage/batch/parsed-records

Parameters

parsedRecord (dict) – See Schema below

Returns

See Schema below

Return type

dict

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

  • 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"
  ]
}
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Response schema for Parsed Records batch requests",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "parsedRecords": {
      "description": "List of successfully processed parsed records",
      "type": "array",
      "id": "recordList",
      "items": {
        "type": "object",
        "$ref": "../mod-source-record-storage/parsedRecord.json"
      }
    },
    "errorMessages": {
      "description": "List of error messages",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "totalRecords": {
      "description": "Total number of parsed records",
      "type": "integer"
    }
  },
  "excludedFromEqualsAndHashCode": [
    "totalRecords"
  ],
  "required": [
    "parsedRecords",
    "totalRecords"
  ]
}
set_fetch(fetch: dict)

Fetch exact fields of parsed records by external IDs.

POST /source-storage/batch/parsed-records/fetch

Parameters

fetch (dict) – See Schema below

Returns

See Schema below

Return type

dict

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

  • OkapiFatalError – Server Error

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Describes entity to fetch exact fields of parsed records by external IDs",
  "javaType": "org.folio.rest.jaxrs.model.FetchParsedRecordsBatchRequest",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "conditions": {
      "description": "Conditions for fetching records by external IDs",
      "type": "object",
      "properties": {
        "idType": {
          "description": "External id type",
          "type": "string"
        },
        "ids": {
          "type": "array",
          "description": "List of external ids",
          "items": {
            "description": "External id",
            "type": "string"
          }
        }
      }
    },
    "data": {
      "description": "Array of requested fields",
      "type": "array",
      "items": {
        "type": "object",
        "javaType": "org.folio.rest.jaxrs.model.FieldRange",
        "description": "Field range to provide",
        "additionalProperties": false,
        "properties": {
          "from": {
            "description": "Segment tag to range from",
            "type": "string"
          },
          "to": {
            "description": "Segment tag to range to",
            "type": "string"
          }
        },
        "required": [
          "from",
          "to"
        ]
      }
    },
    "recordType": {
      "description": "Type of record, e.g. MARC",
      "type": "string",
      "$ref": "../mod-source-record-storage/recordType.json"
    }
  },
  "required": [
    "conditions",
    "recordType"
  ]
}
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Collection of stripped parsed record DTO",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "records": {
      "description": "List of stripped parsed records",
      "type": "array",
      "id": "strippedParsedRecordList",
      "items": {
        "type": "object",
        "$ref": "./strippedParsedRecord.json"
      }
    },
    "totalRecords": {
      "description": "Total number of records",
      "type": "integer"
    }
  },
  "excludedFromEqualsAndHashCode": [
    "totalRecords"
  ],
  "required": [
    "records",
    "totalRecords"
  ]
}
set_record(record: dict)

Creates records from a record collection. It returns both saved records and error messages for records that were not saved.

POST /source-storage/batch/records

Parameters

record (dict) – See Schema below

Returns

See Schema below

Return type

dict

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

  • 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"
  ]
}
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Response schema for Records batch requests",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "records": {
      "description": "List of successfully processed records",
      "type": "array",
      "id": "recordList",
      "items": {
        "type": "object",
        "$ref": "record.json"
      }
    },
    "errorMessages": {
      "description": "List of error messages",
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "totalRecords": {
      "description": "Total number of records",
      "type": "integer"
    }
  },
  "excludedFromEqualsAndHashCode": [
    "totalRecords"
  ],
  "required": [
    "records",
    "totalRecords"
  ]
}
set_verifiedRecord(verifiedRecord: dict)

Get a list of invalid Marc Bib Record IDs, which doesn’t exists in the system

POST /source-storage/batch/verified-records

Parameters

verifiedRecord (dict) – See Schema below

Returns

See Schema below

Return type

dict

Raises
  • OkapiRequestError – Bad Request

  • OkapiFatalError – Server Error

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Schema

string[]
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Collection of Source record DTO",
  "javaType": "org.folio.rest.jaxrs.model.MarcBibCollection",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "invalidMarcBibIds": {
      "description": "List of marc bib records ids, which doesn't exists in the database",
      "type": "array",
      "id": "invalidMarcBibIds",
      "items": {
        "type": "string"
      }
    }
  },
  "required": [
    "invalidMarcBibIds"
  ]
}