foliolib.folio.api.bulkOperations.Bulkoperations

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

Bases: foliolib.folio.FolioApi

Bulk operations API

Bulk operations API

Parameters
  • tenant (str) – Tenant id

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

Methods

cleanuplogfiles()

Removed all files older than 30 days

downloadfilebyoperationid(operationId, **kwargs)

Download file by operation id

getbulkoperationbyid(operationId)

Get bulk operation by id

getbulkoperationcollection(**kwargs)

Get a list of operations

geterrorspreviewbyoperationid(operationId, ...)

Get a list of errors for preview

getpreviewbyoperationid(operationId, **kwargs)

Get preview

postcontentupdates(operationId, ...)

Upload content updates

startbulkoperation(operationId, ...)

Start Bulk Operation

uploadcsvfile(filePath, **kwargs)

Upload csv file with identifiers list (barcodes, UUIDs, HRIDs, etc.) or csv-file with already updated entities

cleanuplogfiles()

Removed all files older than 30 days

POST /bulk-operations/clean-up-log-files

Raises

OkapiFatalError – Internal server errors, e.g. due to misconfiguration

downloadfilebyoperationid(operationId, **kwargs)

Download file by operation id

GET /bulk-operations/{operationId}/download

Parameters

operationId (str) – UUID of the Bulk Operation (format: uuid)

Keyword Arguments

fileContentType (str) – The file content type

Raises
  • OkapiRequestError – Bad request

  • OkapiRequestNotFound – Not found

  • OkapiFatalError – Internal server errors, e.g. due to misconfiguration

getbulkoperationbyid(operationId)

Get bulk operation by id

GET /bulk-operations/{operationId}

Parameters

operationId (str) – UUID of the Bulk Operation (format: uuid)

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestNotFound – Not found

  • OkapiFatalError – Internal server errors, e.g. due to misconfiguration

Schema

{
    "type": "object",
    "properties": {
        "id": {
            "description": "Bulk Operation UUID",
            "type": "string",
            "format": "uuid"
        },
        "hrId": {
            "description": "Bulk Operation human readable ID",
            "type": "integer",
            "format": "int64"
        },
        "userId": {
            "description": "User UUID",
            "type": "string",
            "format": "uuid"
        },
        "operationType": {
            "description": "Bulk Operation type",
            "$ref": "operation_type.json#/OperationType"
        },
        "entityType": {
            "description": "Entity type",
            "$ref": "entity_type.json#/EntityType"
        },
        "entityCustomIdentifierType": {
            "description": "Entity custom identifier type",
            "$ref": "identifier_type.json#/IdentifierType"
        },
        "status": {
            "description": "Bulk Operation status",
            "$ref": "operation_status_type.json#/OperationStatusType"
        },
        "approach": {
            "description": "Bulk Operation approach type",
            "$ref": "approach_type.json#/ApproachType"
        },
        "dataExportJobId": {
            "description": "Data export Job UUID",
            "type": "string",
            "format": "uuid"
        },
        "linkToTriggeringCsvFile": {
            "description": "Path to the bulk operation triggering file",
            "type": "string"
        },
        "linkToMatchedRecordsJsonFile": {
            "description": "Path to the matched (origin) json file",
            "type": "string"
        },
        "linkToMatchedRecordsCsvFile": {
            "description": "Path to the matched (origin) csv file",
            "type": "string"
        },
        "linkToMatchedRecordsErrorsCsvFile": {
            "description": "Path to the matching errors csv file",
            "type": "string"
        },
        "linkToModifiedRecordsJsonFile": {
            "description": "Path to the modified (updated) json file",
            "type": "string"
        },
        "linkToModifiedRecordsCsvFile": {
            "description": "Path to the modified (updated) csv file",
            "type": "string"
        },
        "linkToCommittedRecordsJsonFile": {
            "description": "Path to the committed (result) json file",
            "type": "string"
        },
        "linkToCommittedRecordsCsvFile": {
            "description": "Path to the committed (result) csv file",
            "type": "string"
        },
        "linkToCommittedRecordsErrorsCsvFile": {
            "description": "Path to the committing errors csv file",
            "type": "string"
        },
        "totalNumOfRecords": {
            "description": "Total number of records",
            "type": "integer",
            "format": "int64",
            "default": 0
        },
        "processedNumOfRecords": {
            "description": "Number of processed records",
            "type": "integer",
            "format": "int64",
            "default": 0
        },
        "matchedNumOfRecords": {
            "description": "Number of matched records",
            "type": "integer",
            "format": "int64",
            "default": 0
        },
        "committedNumOfRecords": {
            "description": "Number of committed records",
            "type": "integer",
            "format": "int64",
            "default": 0
        },
        "matchedNumOfErrors": {
            "description": "Number of matching errors",
            "type": "integer",
            "format": "int64",
            "default": 0
        },
        "committedNumOfErrors": {
            "description": "Number of committing errors",
            "type": "integer",
            "format": "int64",
            "default": 0
        },
        "executionChunkSize": {
            "description": "Size of chunk",
            "type": "integer",
            "format": "int64",
            "default": 0
        },
        "startTime": {
            "description": "Bulk Operation start time",
            "type": "string",
            "format": "date-time"
        },
        "endTime": {
            "description": "Bulk Operation end time",
            "type": "string",
            "format": "date-time"
        },
        "errorMessage": {
            "description": "Error message",
            "type": "string"
        },
        "expired": {
            "description": "Were logs expired",
            "type": "boolean",
            "default": false
        }
    },
    "additionalProperties": false,
    "required": [
        "type"
    ]
}
getbulkoperationcollection(**kwargs)

Get a list of operations

GET /bulk-operations

Keyword Arguments
  • query (str) – Request query

  • offset (int) – Query offset

  • limit (int) – Query limit

Returns

See Schema below.

Return type

dict

Raises

OkapiFatalError – Internal server errors, e.g. due to misconfiguration

Schema

{
    "type": "object",
    "properties": {
        "bulkOperations": {
            "description": "List of bulk operations",
            "type": "array",
            "items": {
                "$ref": "bulk_operation_dto.json#/BulkOperationDto"
            },
            "minItems": 1
        },
        "totalRecords": {
            "type": "integer"
        }
    },
    "required": [
        "bulkOperations",
        "totalRecords"
    ],
    "additionalProperties": false
}
geterrorspreviewbyoperationid(operationId, **kwargs)

Get a list of errors for preview

GET /bulk-operations/{operationId}/errors

Parameters

operationId (str) – UUID of the Bulk Operation (format: uuid)

Keyword Arguments

limit (int) – The numbers of errors to return

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestNotFound – No found

  • OkapiFatalError – Internal server errors, e.g. due to misconfiguration

Schema

{
    "description": "A set of errors",
    "type": "object",
    "properties": {
        "errors": {
            "description": "List of errors",
            "id": "errors",
            "type": "array",
            "items": {
                "type": "object",
                "$ref": "error.json"
            }
        },
        "total_records": {
            "description": "Total number of errors",
            "type": "integer"
        }
    },
    "additionalProperties": false
}
getpreviewbyoperationid(operationId, **kwargs)

Get preview

GET /bulk-operations/{operationId}/preview

Parameters

operationId (str) – UUID of the Bulk Operation (format: uuid)

Keyword Arguments
  • step (str) – Key if manual approach is used

  • limit (int) – The numbers of records to return

  • offset (int) – Query offset (default: 0)

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestNotFound – Not found

  • OkapiFatalError – Internal server errors, e.g. due to misconfiguration

Schema

{
    "$schema": "http://json-schema.org/draft-04/schema#",
    "description": "Unified table representation of data",
    "type": "object",
    "properties": {
        "header": {
            "description": "Header",
            "type": "array",
            "items": {
                "$ref": "cell.json"
            }
        },
        "rows": {
            "description": "Rows",
            "type": "array",
            "items": {
                "$ref": "row.json"
            }
        }
    },
    "additionalProperties": false,
    "required": [
        "header",
        "rows"
    ]
}
postcontentupdates(operationId, bulkOperationRuleCollection)

Upload content updates

POST /bulk-operations/{operationId}/content-update

Parameters
  • operationId (str) – UUID of the Bulk Operation (format: uuid)

  • bulkOperationRuleCollection (dict) – See Schema below.

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestError – Bad request

  • OkapiRequestNotFound – Not found

  • OkapiFatalError – Internal server errors, e.g. due to misconfiguration

Schema

{
    "type": "object",
    "properties": {
        "bulkOperationRules": {
            "description": "List of bulk operation rules",
            "type": "array",
            "items": {
                "$ref": "bulk_operation_rule.json#/BulkOperationRule"
            },
            "minItems": 1
        },
        "totalRecords": {
            "type": "integer"
        }
    },
    "required": [
        "bulkOperationRules",
        "totalRecords"
    ],
    "additionalProperties": false
}
startbulkoperation(operationId, bulkOperationStart)

Start Bulk Operation

POST /bulk-operations/{operationId}/start

Parameters
  • operationId (str) – UUID of the Bulk Operation (format: uuid)

  • bulkOperationStart (dict) – See Schema below.

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestNotFound – Bad Request

  • OkapiFatalError – Internal server errors, e.g. due to misconfiguration

Schema

{
    "type": "object",
    "properties": {
        "step": {
            "description": "Bulk operation step",
            "$ref": "bulk_operation_step.json#/BulkOperationStep"
        },
        "approach": {
            "description": "Bulk Operation approach type",
            "$ref": "approach_type.json#/ApproachType"
        },
        "entityType": {
            "description": "Entity type",
            "$ref": "entity_type.json#/EntityType"
        },
        "entityCustomIdentifierType": {
            "description": "Entity custom identifier type",
            "$ref": "identifier_type.json#/IdentifierType"
        },
        "query": {
            "description": "CQL query for",
            "type": "string"
        }
    }
}
{
    "type": "object",
    "properties": {
        "id": {
            "description": "Bulk Operation UUID",
            "type": "string",
            "format": "uuid"
        },
        "hrId": {
            "description": "Bulk Operation human readable ID",
            "type": "integer",
            "format": "int64"
        },
        "userId": {
            "description": "User UUID",
            "type": "string",
            "format": "uuid"
        },
        "operationType": {
            "description": "Bulk Operation type",
            "$ref": "operation_type.json#/OperationType"
        },
        "entityType": {
            "description": "Entity type",
            "$ref": "entity_type.json#/EntityType"
        },
        "entityCustomIdentifierType": {
            "description": "Entity custom identifier type",
            "$ref": "identifier_type.json#/IdentifierType"
        },
        "status": {
            "description": "Bulk Operation status",
            "$ref": "operation_status_type.json#/OperationStatusType"
        },
        "approach": {
            "description": "Bulk Operation approach type",
            "$ref": "approach_type.json#/ApproachType"
        },
        "dataExportJobId": {
            "description": "Data export Job UUID",
            "type": "string",
            "format": "uuid"
        },
        "linkToTriggeringCsvFile": {
            "description": "Path to the bulk operation triggering file",
            "type": "string"
        },
        "linkToMatchedRecordsJsonFile": {
            "description": "Path to the matched (origin) json file",
            "type": "string"
        },
        "linkToMatchedRecordsCsvFile": {
            "description": "Path to the matched (origin) csv file",
            "type": "string"
        },
        "linkToMatchedRecordsErrorsCsvFile": {
            "description": "Path to the matching errors csv file",
            "type": "string"
        },
        "linkToModifiedRecordsJsonFile": {
            "description": "Path to the modified (updated) json file",
            "type": "string"
        },
        "linkToModifiedRecordsCsvFile": {
            "description": "Path to the modified (updated) csv file",
            "type": "string"
        },
        "linkToCommittedRecordsJsonFile": {
            "description": "Path to the committed (result) json file",
            "type": "string"
        },
        "linkToCommittedRecordsCsvFile": {
            "description": "Path to the committed (result) csv file",
            "type": "string"
        },
        "linkToCommittedRecordsErrorsCsvFile": {
            "description": "Path to the committing errors csv file",
            "type": "string"
        },
        "totalNumOfRecords": {
            "description": "Total number of records",
            "type": "integer",
            "format": "int64",
            "default": 0
        },
        "processedNumOfRecords": {
            "description": "Number of processed records",
            "type": "integer",
            "format": "int64",
            "default": 0
        },
        "matchedNumOfRecords": {
            "description": "Number of matched records",
            "type": "integer",
            "format": "int64",
            "default": 0
        },
        "committedNumOfRecords": {
            "description": "Number of committed records",
            "type": "integer",
            "format": "int64",
            "default": 0
        },
        "matchedNumOfErrors": {
            "description": "Number of matching errors",
            "type": "integer",
            "format": "int64",
            "default": 0
        },
        "committedNumOfErrors": {
            "description": "Number of committing errors",
            "type": "integer",
            "format": "int64",
            "default": 0
        },
        "executionChunkSize": {
            "description": "Size of chunk",
            "type": "integer",
            "format": "int64",
            "default": 0
        },
        "startTime": {
            "description": "Bulk Operation start time",
            "type": "string",
            "format": "date-time"
        },
        "endTime": {
            "description": "Bulk Operation end time",
            "type": "string",
            "format": "date-time"
        },
        "errorMessage": {
            "description": "Error message",
            "type": "string"
        },
        "expired": {
            "description": "Were logs expired",
            "type": "boolean",
            "default": false
        }
    },
    "additionalProperties": false,
    "required": [
        "type"
    ]
}
uploadcsvfile(filePath, **kwargs)

Upload csv file with identifiers list (barcodes, UUIDs, HRIDs, etc.) or csv-file with already updated entities

POST /bulk-operations/upload

Parameters

filePath (str) – Path of file to upload.

Keyword Arguments
  • entityType (str) – Entity type (USER, ITEM, HOLDINGS_RECORD)

  • identifierType (str) – Identifier type (ID, BARCODE, etc.)

  • manual (bool) – Key if manual approach is used (default: False)

  • operationId (str) – UUID of the Bulk Operation (applicable for (manual = true) case) (format: uuid)

Returns

See Schema below.

Return type

dict

Raises
  • OkapiRequestError – Bad Request

  • OkapiFatalError – Internal server errors, e.g. due to misconfiguration

Schema

{
    "type": "object",
    "properties": {
        "id": {
            "description": "Bulk Operation UUID",
            "type": "string",
            "format": "uuid"
        },
        "hrId": {
            "description": "Bulk Operation human readable ID",
            "type": "integer",
            "format": "int64"
        },
        "userId": {
            "description": "User UUID",
            "type": "string",
            "format": "uuid"
        },
        "operationType": {
            "description": "Bulk Operation type",
            "$ref": "operation_type.json#/OperationType"
        },
        "entityType": {
            "description": "Entity type",
            "$ref": "entity_type.json#/EntityType"
        },
        "entityCustomIdentifierType": {
            "description": "Entity custom identifier type",
            "$ref": "identifier_type.json#/IdentifierType"
        },
        "status": {
            "description": "Bulk Operation status",
            "$ref": "operation_status_type.json#/OperationStatusType"
        },
        "approach": {
            "description": "Bulk Operation approach type",
            "$ref": "approach_type.json#/ApproachType"
        },
        "dataExportJobId": {
            "description": "Data export Job UUID",
            "type": "string",
            "format": "uuid"
        },
        "linkToTriggeringCsvFile": {
            "description": "Path to the bulk operation triggering file",
            "type": "string"
        },
        "linkToMatchedRecordsJsonFile": {
            "description": "Path to the matched (origin) json file",
            "type": "string"
        },
        "linkToMatchedRecordsCsvFile": {
            "description": "Path to the matched (origin) csv file",
            "type": "string"
        },
        "linkToMatchedRecordsErrorsCsvFile": {
            "description": "Path to the matching errors csv file",
            "type": "string"
        },
        "linkToModifiedRecordsJsonFile": {
            "description": "Path to the modified (updated) json file",
            "type": "string"
        },
        "linkToModifiedRecordsCsvFile": {
            "description": "Path to the modified (updated) csv file",
            "type": "string"
        },
        "linkToCommittedRecordsJsonFile": {
            "description": "Path to the committed (result) json file",
            "type": "string"
        },
        "linkToCommittedRecordsCsvFile": {
            "description": "Path to the committed (result) csv file",
            "type": "string"
        },
        "linkToCommittedRecordsErrorsCsvFile": {
            "description": "Path to the committing errors csv file",
            "type": "string"
        },
        "totalNumOfRecords": {
            "description": "Total number of records",
            "type": "integer",
            "format": "int64",
            "default": 0
        },
        "processedNumOfRecords": {
            "description": "Number of processed records",
            "type": "integer",
            "format": "int64",
            "default": 0
        },
        "matchedNumOfRecords": {
            "description": "Number of matched records",
            "type": "integer",
            "format": "int64",
            "default": 0
        },
        "committedNumOfRecords": {
            "description": "Number of committed records",
            "type": "integer",
            "format": "int64",
            "default": 0
        },
        "matchedNumOfErrors": {
            "description": "Number of matching errors",
            "type": "integer",
            "format": "int64",
            "default": 0
        },
        "committedNumOfErrors": {
            "description": "Number of committing errors",
            "type": "integer",
            "format": "int64",
            "default": 0
        },
        "executionChunkSize": {
            "description": "Size of chunk",
            "type": "integer",
            "format": "int64",
            "default": 0
        },
        "startTime": {
            "description": "Bulk Operation start time",
            "type": "string",
            "format": "date-time"
        },
        "endTime": {
            "description": "Bulk Operation end time",
            "type": "string",
            "format": "date-time"
        },
        "errorMessage": {
            "description": "Error message",
            "type": "string"
        },
        "expired": {
            "description": "Were logs expired",
            "type": "boolean",
            "default": false
        }
    },
    "additionalProperties": false,
    "required": [
        "type"
    ]
}