foliolib.folio.api.dataExport.DataExport

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

Bases: foliolib.folio.FolioApi

Data export API

API for exporting MARC records

Parameters
  • tenant (str) – Tenant id

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

Methods

delete_jobExecution(jobExecutionsId)

DELETE /data-export/job-executions/{jobExecutionsId}

get_download(jobExecutionId, exportFileId)

GET /data-export/job-executions/{jobExecutionId}/download/{exportFileId}

get_jobExecutions(**kwargs)

Retrieve jobExecution item with given {jobExecutionId}

set_cleanUpFile()

POST /data-export/clean-up-files

set_expireJob()

POST /data-export/expire-jobs

set_export(export)

Starts the export process

set_quickExport(quickExport)

Starts the export process

delete_jobExecution(jobExecutionsId: str)

DELETE /data-export/job-executions/{jobExecutionsId}

Parameters

jobExecutionsId (str) –

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestNotFound – Not Found

  • OkapiFatalError – Server Error

get_download(jobExecutionId: str, exportFileId: str)

GET /data-export/job-executions/{jobExecutionId}/download/{exportFileId}

Parameters
  • jobExecutionId (str) –

  • exportFileId (str) –

Returns

See Schema below

Return type

dict

Raises
  • OkapiRequestError – Bad Request

  • OkapiFatalError – Server Error

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "File that should be exported",
  "type": "object",
  "properties": {
    "fileId": {
      "description": "File unique identifier",
      "$ref": "../../ramls/raml-util/schemas/uuid.schema"
    },
    "link": {
      "description": "Download link to the file",
      "type": "string"
    }
  },
  "required": [
    "fileId",
    "link"
  ]
}
get_jobExecutions(**kwargs)

Retrieve jobExecution item with given {jobExecutionId}

GET /data-export/job-executions

Parameters

**kwargs (properties) – Keyword Arguments

Keyword Arguments
  • 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.

    with valid searchable fields

    Example

    • (username==”ab*” or personal.firstName==”ab*” or personal.lastName==”ab*”) and active==”true” sortby personal.lastName personal.firstName barcode

    • status=SUCCESS

  • 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

  • OkapiRequestNotFound – Not Found

  • OkapiFatalError – Server Error

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Collection of execution jobs",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "jobExecutions": {
      "description": "List of execution jobs",
      "type": "array",
      "id": "jobExecutionList",
      "items": {
        "type": "object",
        "$ref": "jobExecution.json"
      }
    },
    "totalRecords": {
      "type": "integer"
    }
  },
  "required": [
    "jobExecutions",
    "totalRecords"
  ]
}
set_cleanUpFile()

POST /data-export/clean-up-files

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

  • OkapiFatalError – Server Error

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

set_expireJob()

POST /data-export/expire-jobs

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

  • OkapiFatalError – Server Error

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

set_export(export: dict)

Starts the export process

POST /data-export/export

Parameters

export (dict) – See Schema below

Raises
  • OkapiRequestError – Bad Request

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

  • OkapiFatalError – Server Error

  • OkapiRequestUnprocessableEntity – Unprocessable Entity

Schema

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Necessary data to start export process",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "fileDefinitionId": {
      "description": "File definition id",
      "$ref": "../../ramls/raml-util/schemas/uuid.schema"
    },
    "jobProfileId": {
      "description": "Related Job profile id",
      "$ref": "../../ramls/raml-util/schemas/uuid.schema"
    },
    "recordType": {
      "description": "Defines a type of records to search by criteria or UUIDs",
      "type": "string",
      "enum": [
        "INSTANCE",
        "HOLDINGS",
        "ITEM",
        "AUTHORITY"
      ]
    },
    "idType": {
      "description": "Type of provided uuids",
      "type": "string",
      "enum": [
        "instance",
        "holding",
        "authority"
      ],
      "default": "instance"
    },
    "metadata": {
      "description": "Meta information ",
      "type": "object",
      "$ref": "../../ramls/raml-util/schemas/metadata.schema"
    }
  },
  "required": [
    "fileDefinitionId",
    "jobProfileId",
    "idType"
  ]
}
set_quickExport(quickExport: dict)

Starts the export process

POST /data-export/quick-export

Parameters

quickExport (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": "Necessary data to start export process from inventory",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "jobProfileId": {
      "description": "Job profile id to be used for export",
      "$ref": "../../ramls/raml-util/schemas/uuid.schema"
    },
    "criteria": {
      "description": "CQL query for records search",
      "type": "string"
    },
    "uuids": {
      "description": "List of UUIDs of records to export",
      "type": "array",
      "items": {
        "type": "string",
        "$ref": "../../ramls/raml-util/schemas/uuid.schema"
      }
    },
    "type": {
      "description": "Defines a type of searching the records: by UUIDs or CQL query",
      "type": "string",
      "enum": [
        "cql",
        "uuid"
      ]
    },
    "recordType": {
      "description": "Defines a type of records to search by criteria or UUIDs",
      "type": "string",
      "enum": [
        "INSTANCE",
        "HOLDINGS",
        "ITEM",
        "AUTHORITY"
      ]
    },
    "fileName": {
      "description": "Name of the generated marc file",
      "type": "string"
    },
    "metadata": {
      "description": "Meta information ",
      "type": "object",
      "$ref": "../../ramls/raml-util/schemas/metadata.schema"
    }
  },
  "required": [
    "type",
    "recordType"
  ]
}
{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Quick export response",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "jobExecutionId": {
      "description": "UUID of the job execution, that is used for quick export",
      "type": "string",
      "$ref": "../../ramls/raml-util/schemas/uuid.schema"
    },
    "jobExecutionHrId": {
      "description": "HrId of the job execution, that is used for quick export",
      "type": "integer"
    }
  },
  "required": [
    "jobExecutionId",
    "jobExecutionHrId"
  ]
}