foliolib.folio.api.copycat.Copycat
- class foliolib.folio.api.copycat.Copycat(tenant: str, okapi: Optional[foliolib.okapi.okapiClient.OkapiClient] = None)
Bases:
foliolib.folio.FolioApi- Parameters
tenant (str) – Tenant id
okapi (OkapiClient, optional) – Instance of OkapiClient. Defaults to None.
Methods
delete_profile(profilesId)Delete target profile
get_profile(profilesId)Get profile
get_profiles(**kwargs)Get profiles
modify_profile(profilesId, profile)Update target profile
set_import(import_)Import record from external system
set_profile(profile)Create profile
- delete_profile(profilesId: str)
Delete target profile
DELETE /copycat/profiles/{profilesId}- Parameters
profilesId (str) –
- Raises
OkapiRequestError – Bad Request
OkapiRequestNotFound – Not Found
OkapiFatalError – Server Error
- get_profile(profilesId: str)
Get profile
GET /copycat/profiles/{profilesId}- Parameters
profilesId (str) –
- 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#", "title": "copycat profile", "description": "copycat import profile", "type": "object", "properties": { "id": { "type": "string", "description": "unique identifier and primary key" }, "name": { "type": "string", "description": "Human-readable name" }, "url": { "type": "string", "description": "Location of remote service to obtain records from" }, "authentication": { "type": "string", "description": "Authentication credentials to use for the remote service" }, "externalIdQueryMap": { "type": "string", "description": "Specifies which field at the remote service should be searched with the value of `externalIdentifier` when an import request is POSTed. Could be specified as a YAZ prefix-query string, e.g. '@attr 1=12 $identifier'" }, "internalIdEmbedPath": { "type": "string", "description": "Specifies where the internalIdentifier is to be embedded in the MARC record, e.g. '999__$i' to place it in field 999, indicator double space (absent) and subfield i; this field only has effect when internalIdentifier is present" }, "createJobProfileId": { "type": "string", "description": "Default job profile to use for create", "$ref": "raml-util/schemas/uuid.schema" }, "updateJobProfileId": { "type": "string", "description": "Default job profile to use for update", "$ref": "raml-util/schemas/uuid.schema" }, "allowedCreateJobProfileIds": { "type": "array", "description": "Job profiles to use for create", "items": { "type": "string", "$ref": "raml-util/schemas/uuid.schema" } }, "allowedUpdateJobProfileIds": { "type": "array", "description": "Job profiles to use for update", "items": { "type": "string", "$ref": "raml-util/schemas/uuid.schema" } }, "targetOptions": { "type": "object", "description": "A 1-level Json Object containing ZOOM options. The most important ones being preferredRecordSyntax, charset, marcencoding (encoding for retrieved MARC records - default is marc-8). See https://software.indexdata.com/yaz/doc/zoom.html#zoom-connections and https://software.indexdata.com/yaz/doc/zoom.resultsets.html#zoom.resultset.options" }, "externalIdentifierType": { "type": "string", "description": "UUID of an identifier-type defined by the inventory module", "$ref": "raml-util/schemas/uuid.schema" }, "enabled": { "type": "boolean", "description": "Whether this profile should be presented to users importing records" } }, "additionalProperties": false, "required": [ "name", "createJobProfileId", "updateJobProfileId" ] }
- get_profiles(**kwargs)
Get profiles
GET /copycat/profiles- 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
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.
search profiles
Example
(username==”ab*” or personal.firstName==”ab*” or personal.lastName==”ab*”) and active==”true” sortby personal.lastName personal.firstName barcode
name = loc
- Returns
See Schema below
- Return type
dict
- Raises
OkapiRequestError – Bad Request
OkapiFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "CopyCat Profiles Response", "description": "CopyCat Profiles", "type": "object", "properties": { "profiles": { "description": "List of CopyCat profiles", "type": "array", "items": { "type": "object", "$ref": "copycatprofile.json" } }, "totalRecords": { "type": "integer" } }, "required": [ "profiles", "totalRecords" ] }
- modify_profile(profilesId: str, profile: dict)
Update target profile
PUT /copycat/profiles/{profilesId}- Parameters
profilesId (str) –
profile (dict) – See Schema below
- Raises
OkapiRequestError – Bad Request
OkapiRequestNotFound – Not Found
OkapiFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "copycat profile", "description": "copycat import profile", "type": "object", "properties": { "id": { "type": "string", "description": "unique identifier and primary key" }, "name": { "type": "string", "description": "Human-readable name" }, "url": { "type": "string", "description": "Location of remote service to obtain records from" }, "authentication": { "type": "string", "description": "Authentication credentials to use for the remote service" }, "externalIdQueryMap": { "type": "string", "description": "Specifies which field at the remote service should be searched with the value of `externalIdentifier` when an import request is POSTed. Could be specified as a YAZ prefix-query string, e.g. '@attr 1=12 $identifier'" }, "internalIdEmbedPath": { "type": "string", "description": "Specifies where the internalIdentifier is to be embedded in the MARC record, e.g. '999__$i' to place it in field 999, indicator double space (absent) and subfield i; this field only has effect when internalIdentifier is present" }, "createJobProfileId": { "type": "string", "description": "Default job profile to use for create", "$ref": "raml-util/schemas/uuid.schema" }, "updateJobProfileId": { "type": "string", "description": "Default job profile to use for update", "$ref": "raml-util/schemas/uuid.schema" }, "allowedCreateJobProfileIds": { "type": "array", "description": "Job profiles to use for create", "items": { "type": "string", "$ref": "raml-util/schemas/uuid.schema" } }, "allowedUpdateJobProfileIds": { "type": "array", "description": "Job profiles to use for update", "items": { "type": "string", "$ref": "raml-util/schemas/uuid.schema" } }, "targetOptions": { "type": "object", "description": "A 1-level Json Object containing ZOOM options. The most important ones being preferredRecordSyntax, charset, marcencoding (encoding for retrieved MARC records - default is marc-8). See https://software.indexdata.com/yaz/doc/zoom.html#zoom-connections and https://software.indexdata.com/yaz/doc/zoom.resultsets.html#zoom.resultset.options" }, "externalIdentifierType": { "type": "string", "description": "UUID of an identifier-type defined by the inventory module", "$ref": "raml-util/schemas/uuid.schema" }, "enabled": { "type": "boolean", "description": "Whether this profile should be presented to users importing records" } }, "additionalProperties": false, "required": [ "name", "createJobProfileId", "updateJobProfileId" ] }
- set_import(import_: dict)
Import record from external system
POST /copycat/imports- Parameters
import (dict) – See Schema below
- Returns
See Schema below
- Return type
dict
- Raises
OkapiRequestError – Bad Request
OkapiFatalError – Server Error
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "tags", "description": "copycat import request/response", "type": "object", "properties": { "externalIdentifier": { "description": "external identifier for the record (for Z39.50 retrieval)", "type": "string" }, "internalIdentifier": { "description": "FOLIO instance identifier for the record; specify when a record should be updated", "type": "string" }, "profileId": { "description": "profile to be used for importing", "type": "string" }, "selectedJobProfileId": { "description": "Job profile to be used for importing", "type": "string", "$ref": "raml-util/schemas/uuid.schema" }, "record": { "description": "local record", "type": "object", "properties": { "json": { "description": "JSON MARC record object within json property", "type": "string" }, "marc": { "description": "base64 encoded ISO2709 MARC", "type": "string" } } } }, "additionalProperties": false, "required": [ "profileId" ] }
- set_profile(profile: dict)
Create profile
POST /copycat/profiles- Parameters
profile (dict) – See Schema below
- Returns
See Schema below
- Return type
dict
- Raises
OkapiRequestError – Bad Request
OkapiFatalError – Server Error
Headers
Location - URI of profile
Schema
{ "$schema": "http://json-schema.org/draft-04/schema#", "title": "copycat profile", "description": "copycat import profile", "type": "object", "properties": { "id": { "type": "string", "description": "unique identifier and primary key" }, "name": { "type": "string", "description": "Human-readable name" }, "url": { "type": "string", "description": "Location of remote service to obtain records from" }, "authentication": { "type": "string", "description": "Authentication credentials to use for the remote service" }, "externalIdQueryMap": { "type": "string", "description": "Specifies which field at the remote service should be searched with the value of `externalIdentifier` when an import request is POSTed. Could be specified as a YAZ prefix-query string, e.g. '@attr 1=12 $identifier'" }, "internalIdEmbedPath": { "type": "string", "description": "Specifies where the internalIdentifier is to be embedded in the MARC record, e.g. '999__$i' to place it in field 999, indicator double space (absent) and subfield i; this field only has effect when internalIdentifier is present" }, "createJobProfileId": { "type": "string", "description": "Default job profile to use for create", "$ref": "raml-util/schemas/uuid.schema" }, "updateJobProfileId": { "type": "string", "description": "Default job profile to use for update", "$ref": "raml-util/schemas/uuid.schema" }, "allowedCreateJobProfileIds": { "type": "array", "description": "Job profiles to use for create", "items": { "type": "string", "$ref": "raml-util/schemas/uuid.schema" } }, "allowedUpdateJobProfileIds": { "type": "array", "description": "Job profiles to use for update", "items": { "type": "string", "$ref": "raml-util/schemas/uuid.schema" } }, "targetOptions": { "type": "object", "description": "A 1-level Json Object containing ZOOM options. The most important ones being preferredRecordSyntax, charset, marcencoding (encoding for retrieved MARC records - default is marc-8). See https://software.indexdata.com/yaz/doc/zoom.html#zoom-connections and https://software.indexdata.com/yaz/doc/zoom.resultsets.html#zoom.resultset.options" }, "externalIdentifierType": { "type": "string", "description": "UUID of an identifier-type defined by the inventory module", "$ref": "raml-util/schemas/uuid.schema" }, "enabled": { "type": "boolean", "description": "Whether this profile should be presented to users importing records" } }, "additionalProperties": false, "required": [ "name", "createJobProfileId", "updateJobProfileId" ] }