foliolib.folio.api.sourceRecordStorage.SourceRecordStorageRecords
- class foliolib.folio.api.sourceRecordStorage.SourceRecordStorageRecords(tenant: str)
Bases:
foliolib.folio.FolioApiSource Record Storage Record API
API for managing records
Base class of the Folio API
- Parameters
tenant (str) – Tenant id
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_generation(recordsId, generation)Updates a specific Record with incremented generation and state ACTUAL by matched id
modify_record(recordsId, record)Update record item with given {recordId}
modify_suppressFromDiscovery(recordsId, **kwargs)Update Record suppress from discovery additional information
set_matching(matching)Collection of pairs of marc record ID to external entity ID (instance, holdings, authority)
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
OkapiRequestFatalError – 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
OkapiRequestFatalError – 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
OkapiRequestFatalError – 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
OkapiRequestFatalError – 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_generation(recordsId: str, generation: dict)
Updates a specific Record with incremented generation and state ACTUAL by matched id
PUT /source-storage/records/{recordsId}/generation- Parameters
recordsId (str) –
generation (dict) – See Schema below
- Returns
See Schema below
- Return type
dict
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_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
OkapiRequestFatalError – 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
OkapiRequestFatalError – Server Error
- set_matching(matching: dict)
Collection of pairs of marc record ID to external entity ID (instance, holdings, authority)
POST /source-storage/records/matching- Parameters
matching (dict) – See Schema below
- Returns
See Schema below
- Return type
dict
- Raises
OkapiRequestFatalError – Server Error
OkapiRequestUnprocessableEntity – Unprocessable Entity
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "Schema for records matching request", "type": "object", "additionalProperties": false, "properties": { "logicalOperator": { "description": "Logical operator that will be used to combine defined filters", "type": "string", "enum": [ "AND", "OR" ], "default": "AND" }, "filters": { "description": "Collection of conditions for records matching", "type": "array", "minItems": 1, "items": { "type": "object", "additionalProperties": false, "properties": { "values": { "description": "Collection of values to match for equality", "type": "array", "minItems": 1, "items": { "type": "string" } }, "field": { "description": "MARC field tag to match", "type": "string", "pattern": "^[0-9]{3}$" }, "indicator1": { "description": "MARC field indicator1 to match. Value can be a lowercase alphabetic, numeric, blank, or * meaning a wildcard", "type": "string", "pattern": "^[a-z0-9\\s*]?$" }, "indicator2": { "description": "MARC field indicator2 to match. Value can be a lowercase alphabetic, numeric, blank, or * meaning a wildcard", "type": "string", "pattern": "^[a-z0-9\\s*]?$" }, "subfield": { "description": "MARC subfield to match, allowed value can be ASCII lowercase alphabetic or numeric character", "type": "string", "pattern": "^[a-z0-9]?$" }, "matchType": { "description": "Match type to consider for the query", "type": "string", "enum": [ "EXACTLY_MATCHES", "EXISTING_VALUE_CONTAINS_INCOMING_VALUE", "INCOMING_VALUE_CONTAINS_EXISTING_VALUE", "EXISTING_VALUE_BEGINS_WITH_INCOMING_VALUE", "INCOMING_VALUE_BEGINS_WITH_EXISTING_VALUE", "EXISTING_VALUE_ENDS_WITH_INCOMING_VALUE", "INCOMING_VALUE_ENDS_WITH_EXISTING_VALUE" ], "default": "EXACTLY_MATCHES" }, "qualifier": { "description": "Qualifier for match criteria", "type": "string", "enum": [ "BEGINS_WITH", "ENDS_WITH", "CONTAINS" ] }, "comparisonPartType": { "description": "Part of a value to compare", "type": "string", "enum": [ "NUMERICS_ONLY", "ALPHANUMERICS_ONLY" ] } }, "required": [ "field", "values" ] } }, "recordType": { "description": "Type of MARC record", "type": "string", "enum": [ "MARC_BIB", "MARC_AUTHORITY", "MARC_HOLDING" ] }, "limit": { "description": "Limitation of the number of elements returned in the response", "type": "integer", "minimum": 1, "default": 1000 }, "offset": { "description": "Offset to skip over a number of elements", "type": "integer", "minimum": 0, "default": 0 }, "returnTotalRecordsCount": { "description": "Indicates whether it is needed to return total count of records matching the specified filters", "type": "boolean", "default": true } }, "required": [ "filters", "recordType" ] }
{ "$schema": "http://json-schema.org/draft-04/schema#", "description": "Collection of pairs of MARC record id and external entity id", "type": "object", "additionalProperties": false, "properties": { "identifiers": { "description": "List of pairs of records identifiers", "type": "array", "items": { "additionalProperties": false, "type": "object", "javaType": "org.folio.rest.jaxrs.model.RecordIdentifiersDto", "properties": { "recordId": { "description": "MARC record UUID", "$ref": "../../raml-util/schemas/uuid.schema" }, "externalId": { "description": "UUID of external entity (instance, holdings, authority)", "$ref": "../../raml-util/schemas/uuid.schema" } } } }, "totalRecords": { "type": "integer" } }, "required": [ "identifiersPairs", "totalRecords" ] }
- 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
OkapiRequestFatalError – 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" ] }