Export history (v1)

https://github.com/folio-org/mod-orders

Table of contents

Export history Logic API

API for managing export history

Pieces

Create export-history record

GET /orders/export-history

Retrieve export-history item with given {export-historyId}

GET /orders/export-history
Query Parameters
  • totalRecords: (string - default: auto - pattern: exact|estimated|none|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: (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
  • 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.

    using CQL (indexes for export-history records)

    Example:

    (username=="ab*" or personal.firstName=="ab*" or personal.lastName=="ab*") and active=="true" sortby personal.lastName personal.firstName barcode
    
    exportType=="EDIFACT_ORDERS_EXPORT"
    

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 export histories",
  "type": "object",
  "properties": {
    "exportHistories": {
      "description": "Collection of export histories",
      "type": "array",
      "id": "export_history",
      "items": {
        "type": "object",
        "$schema": "http://json-schema.org/draft-04/schema#",
        "description": "Export orders or order lines history",
        "properties": {
          "id": {
            "description": "UUID of this history record",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "type": "string",
            "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
          },
          "exportJobId": {
            "description": "UUID of the export Job",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "type": "string",
            "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
          },
          "exportType": {
            "description": "Export type",
            "type": "string"
          },
          "jobStatus": {
            "description": "Job status",
            "type": "string"
          },
          "jobName": {
            "description": "Job name",
            "type": "string"
          },
          "exportMethod": {
            "description": "Export method name",
            "type": "string"
          },
          "exportFileName": {
            "description": "Export file name",
            "type": "string"
          },
          "vendorId": {
            "description": "UUID of vendor",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "type": "string",
            "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-5][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
          },
          "vendorName": {
            "description": "Vendor name",
            "type": "string"
          },
          "exportDate": {
            "description": "Export date",
            "type": "string",
            "format": "date-time"
          },
          "exportedPoLineIds": {
            "description": "References the purchase order lines associated to the export",
            "id": "exportedPoLineIds",
            "type": "array",
            "items": {
              "description": "UUID of the purchase order line",
              "type": "string"
            }
          }
        },
        "additionalProperties": false,
        "required": [
          "exportType",
          "exportJobId",
          "exportDate"
        ]
      }
    },
    "totalRecords": {
      "description": "The number of objects contained in this collection",
      "type": "integer"
    }
  },
  "additionalProperties": false,
  "required": [
    "exportHistories",
    "totalRecords"
  ]
}

Example:

{
  "exportHistories":
  [
    {
      "id": "99fb699a-cdf1-11e9-a9d9-f2801f1b9aa1",
      "exportType": "EDIFACT_ORDERS_EXPORT",
      "exportJobId": "22fb627a-cdf1-11e8-a8d5-f2801f1b9aa1",
      "exportDate": "2020-12-25",
      "exportedPoLineIds": [
        "11fb627a-cdf1-11e8-a8d5-f2801f1b9fd1",
        "11fb627a-cdf1-11e8-a8d5-f2801f1b9fd2",
        "11fb627a-cdf1-11e8-a8d5-f2801f1b9fd3",
        "11fb627a-cdf1-11e8-a8d5-f2801f1b9fd4"
      ]
    },
    {
      "id": "99fb699a-cdf1-11e9-a9d9-f2801f1b9aa2",
      "exportType": "EDIFACT_ORDERS_EXPORT",
      "exportJobId": "22fb627a-cdf1-11e8-a8d5-f2801f1b9aa2",
      "exportDate": "2020-12-26",
      "exportedPoLineIds": [
        "11fb627a-cdf1-11e8-a8d5-f2801f1b9fd4",
        "11fb627a-cdf1-11e8-a8d5-f2801f1b9fd2",
        "11fb627a-cdf1-11e8-a8d5-f2801f1b9fd5",
        "11fb627a-cdf1-11e8-a8d5-f2801f1b9fd4"
      ]
    }
  ],
  "totalRecords": 2
}

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 export-history -- 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 export-history -- unauthorized"

Response 404

Item with a given ID not found

Body

Media type: text/plain

Type: any

Example:

"export-history not found"

Response 422

Validation errors

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "id": "errors.schema",
  "description": "A set of errors",
  "type": "object",
  "properties": {
    "errors": {
      "description": "List of errors",
      "id": "errors",
      "type": "array",
      "items": {
        "type": "object",
        "$schema": "http://json-schema.org/draft-04/schema#",
        "id": "error.schema",
        "description": "An error",
        "properties": {
          "message": {
            "type": "string",
            "description": "Error message text"
          },
          "type": {
            "type": "string",
            "description": "Error message type"
          },
          "code": {
            "type": "string",
            "description": "Error message code"
          },
          "parameters": {
            "description": "Error message parameters",
            "$schema": "http://json-schema.org/draft-04/schema#",
            "id": "parameters.schema",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "key": {
                  "type": "string"
                },
                "value": {
                  "type": "string"
                }
              }
            }
          }
        },
        "required": [
          "message"
        ]
      }
    },
    "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