foliolib.folio.api.sourceRecordStorage.SourceRecordStorageSourceRecords

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

Bases: foliolib.folio.FolioApi

Source Record Storage Source Record API

API for fetching source records

Parameters
  • tenant (str) – Tenant id

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

Methods

get_sourceRecord(sourceRecordsId, **kwargs)

selection condition of sourceRecords by which id will be searched record

get_sourceRecords(**kwargs)

Get a list of Source Records

set_sourceRecord(sourceRecord, **kwargs)

Get a list of Source Records from list of ids

get_sourceRecord(sourceRecordsId: str, **kwargs)

selection condition of sourceRecords by which id will be searched record

GET /source-storage/source-records/{sourceRecordsId}

Parameters
  • sourceRecordsId (str) –

  • **kwargs (properties) – Keyword Arguments

Keyword Arguments
  • idType (str) –

    (default=RECORD) Type of id for record lookup

    Example

    • INSTANCE

  • state (str) –

    (default=ACTUAL) State of the looking record

    Example

    • DELETED

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": "Source record DTO Schema",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "recordId": {
      "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"
    },
    "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"
    },
    "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"
    },
    "metadata": {
      "description": "Metadata provided by the server",
      "type": "object",
      "$ref": "../../raml-util/schemas/metadata.schema",
      "readonly": true
    }
  },
  "required": [
    "recordId",
    "snapshotId",
    "recordType",
    "rawRecord",
    "parsedRecord"
  ]
}
get_sourceRecords(**kwargs)

Get a list of Source Records

GET /source-storage/source-records

Parameters

**kwargs (properties) – Keyword Arguments

Keyword Arguments
  • recordId (str) –

    Filter by Record Id

    Example

    • 876270bc-fbb4-409d-b8b0-3f59b1cb61f2

  • snapshotId (str) –

    Filter by Snapshot Id

    Example

    • 7a8fbd77-5b2a-496c-93e7-cd04478f4fcc

  • externalId (str) –

    Filter by external entity Id

    Example

    • 8b07da70-8ea7-4acd-83a0-44d83979c73b

  • externalHrid (str) –

    Filter by external entity Hrid

    Example

    • 12345

  • instanceId (str) –

    Filter by Instance Id

    Example

    • 8b07da70-8ea7-4acd-83a0-44d83979c73b

  • instanceHrid (str) –

    Filter by Instance Hrid

    Example

    • 12345

  • holdingsId (str) –

    Filter by Holdings Id

    Example

    • 8b07da70-8ea7-4acd-83a0-44d83979c73b

  • holdingsHrid (str) –

    Filter by Holdings Hrid

    Example

    • 12345

  • recordType (str) –

    (default=MARC_BIB) Filter by Record Type

    Example

    • MARC_BIB

  • suppressFromDiscovery (bool) –

    Filter by suppress from discovery

    Example

    • True

  • deleted (bool) –

    (default=False) Filter by records with state ACTUAL OR state DELETED OR leader 05 status d, s, or x

    Example

    • True

  • leaderRecordStatus (str) –

    Filter by MARC leader 05 status

    Example

    • n

  • updatedAfter (datetime) – Start date to filter after, inclusive

  • updatedBefore (datetime) – End date to filter before, inclusive

  • orderBy (list) –

    Sort records

    Example

    • [‘order,ASC’]

  • 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

  • OkapiFatalError – Server Error

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Collection of Source record DTO",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "sourceRecords": {
      "description": "List of Source records",
      "type": "array",
      "id": "sourceRecordList",
      "items": {
        "type": "object",
        "$ref": "sourceRecord.json"
      }
    },
    "totalRecords": {
      "description": "Total number of Source records",
      "type": "integer"
    }
  },
  "excludedFromEqualsAndHashCode": [
    "totalRecords"
  ],
  "required": [
    "sourceRecords",
    "totalRecords"
  ]
}
set_sourceRecord(sourceRecord: dict, **kwargs)

Get a list of Source Records from list of ids

POST /source-storage/source-records

Parameters
  • sourceRecord (dict) –

  • **kwargs (properties) – Keyword Arguments: See Schema below

Keyword Arguments
  • idType (str) –

    (default=RECORD) Type of id for Record lookup

    Example

    • INSTANCE

  • recordType (str) –

    (default=MARC_BIB) Filter by Record Type

    Example

    • MARC_BIB

  • deleted (bool) –

    (default=False) Filter by records with state ACTUAL OR state DELETED OR leader 05 status d, s, or x

    Example

    • True

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",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "sourceRecords": {
      "description": "List of Source records",
      "type": "array",
      "id": "sourceRecordList",
      "items": {
        "type": "object",
        "$ref": "sourceRecord.json"
      }
    },
    "totalRecords": {
      "description": "Total number of Source records",
      "type": "integer"
    }
  },
  "excludedFromEqualsAndHashCode": [
    "totalRecords"
  ],
  "required": [
    "sourceRecords",
    "totalRecords"
  ]
}