Data export (v2.0)

https://github.com/folio-org/mod-data-export

Table of contents

Data export API

API for exporting MARC records

/data-export

POST /data-export/export

Starts the export process

POST /data-export/export
Body

Media type: application/json

Type: json

Content:

{
  "$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"
    },
    "metadata": {
      "description": "Meta information ",
      "type": "object",
      "$ref": "../../ramls/raml-util/schemas/metadata.schema"
    }
  },
  "required": [
    "fileDefinitionId",
    "jobProfileId"
  ]
}

Example:

{
  "fileDefinitionId": "e5f54eb6-6d11-11ea-bc55-0242ac130003",
  "jobProfileId": "2fd2bf30-9d03-4f7e-9393-df55eaef2c2f",
  "metadata": {
    "createdDate": "2019-07-22T11:22:07Z",
    "createdByUserId": "dee12548-9cee-45fa-bbae-675c1cc0ce3b",
    "createdByUsername": "janedoeuser",
    "updatedDate": "2019-07-27T13:28:54Z",
    "updatedByUserId": "dee12548-9cee-45fa-bbae-675c1cc0ce3b",
    "updatedByUsername": ""
  }
}

Response 204

Response 400

Bad request

Body

Media type: text/plain

Type: any

Example:

Bad request

Response 422

Unprocessable Entity

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A set of errors",
  "type": "object",
  "properties": {
    "errors": {
      "description": "List of errors",
      "id": "errors",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "error.schema"
      }
    },
    "total_records": {
      "description": "Total number of errors",
      "type": "integer"
    }
  }
}

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

Response 500

Internal server error

Body

Media type: text/plain

Type: any

Example:

Internal server error

GET /data-export/jobExecutions

Retrieve jobExecution item with given {jobExecutionId}

GET /data-export/jobExecutions
Query Parameters
  • query: (string)

    A query expressed as a CQL string (see 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: (integer - default: 0 - minimum: 0 - maximum: 2147483647)

    Skip over a number of elements by specifying an offset value for the query

    Example:

    0
  • limit: (integer - default: 10 - minimum: 0 - maximum: 2147483647)

    Limit the number of elements returned in the response

    Example:

    10
  • lang: (string - default: en - pattern: [a-zA-Z]{2})

    Requested language. Optional. [lang=en]

Response 200

Returns item with a given ID

Body

Media type: application/json

Type: json

Content:

{
  "$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"
  ]
}

Example:

{
  "jobExecutions": [
    {
      "id": "67dfac11-1caf-4470-9ad1-d533f6360bdd",
      "hrId": "199",
      "exportedFiles": [
        {
          "fileId": "448ae575-daec-49c1-8041-d64c8ed8e5b1",
          "fileName": "catrepbarcodes-20200116114002.mrc"
        },
        {
          "fileId": "295e28b4-aea2-4458-9073-385a31e1da05",
          "fileName": "fullexportbibonly-20200116103001.mrc"
        },
        {
          "fileId": "bb689511-5365-4050-8084-a03d94728d88",
          "fileName": "umadm-n-20200116100503.mrc"
        }
      ],
      "jobProfileInfo": {
        "id": "88dfac11-1caf-4470-9ad1-d533f6360bad",
        "destination": "fileSystem",
        "name": "default"
      },
      "progress": {
        "exported": 109000,
        "failed": 485,
        "total": "109485"
      },
      "completedDate": "2019-10-30T12:40:01.000+0000",
      "startedDate": "2019-10-30T12:37:02.000+0000",
      "runBy": {
        "firstName": "Jane",
        "lastName": "Doe"
      },
      "status": "SUCCESS",
      "metadata": {
        "createdDate": "2019-07-22T11:22:07.000+0000",
        "createdByUserId": "dee12548-9cee-45fa-bbae-675c1cc0ce3b",
        "createdByUsername": "janedoeuser",
        "updatedDate": "2019-07-27T13:28:54.000+0000",
        "updatedByUserId": "",
        "updatedByUsername": ""
      }
    }
  ],
  "totalRecords": 1
}

Response 400

Bad request, e.g. malformed request body or query parameter. Details of the error (e.g. name of the parameter or line/character number with malformed data) provided in the response.

Body

Media type: text/plain

Type: any

Example:

"unable to list jobExecutions -- malformed parameter 'query', syntax error at column 6"

Response 401

Not authorized to perform requested action

Body

Media type: text/plain

Type: any

Example:

"unable to list jobExecutions -- unauthorized"

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"jobExecution not found"

Response 422

Validation errors

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A set of errors",
  "type": "object",
  "properties": {
    "errors": {
      "description": "List of errors",
      "id": "errors",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "error.schema"
      }
    },
    "total_records": {
      "description": "Total number of errors",
      "type": "integer"
    }
  }
}

Example:

{
  "errors": [
    {
      "message": "may not be null",
      "type": "1",
      "code": "-1",
      "parameters": [
        {
          "key": "moduleTo",
          "value": "null"
        }
      ]
    }
  ]
}

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

internal server error, contact administrator

GET /data-export/jobExecutions/{jobExecutionId}/download/{exportFileId}

GET /data-export/jobExecutions/{jobExecutionId}/download/{exportFileId}
URI Parameters
  • jobExecutionId: required (string)
  • exportFileId: required (string)

Response 200

Body

Media type: application/json

Type: json

Content:

{
  "$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"
  ]
}

Example:

{
   "fileId":"448ae575-daec-49c1-8041-d64c8ed8e5b1",
   "link":"https://test-aws-export-vk.s3.amazonaws.com/CatShip.mrc?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Date=20200220T185104Z&X-Amz-SignedHeaders=host&X-Amz-Expires=3599&X-Amz-Credential=AKUAIZOH6UABI4QDF678%2F20200220%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Signature=2d87fd96cd1b05ee74228ee9124bc0ad34196a08b03c62453e9588aa3e485a77"
}

Response 400

Bad request, e.g. malformed request body or query parameter

Body

Media type: text/plain

Type: any

Example:

Bad request

Response 500

Internal server error, e.g. due to misconfiguration

Body

Media type: text/plain

Type: any

Example:

Internal server error, contact Administrator