Inventory Storage Item Batch Sync Unsafe API (v2.0)

http://localhost

Table of contents

Inventory Storage Item Batch Sync Unsafe API

Batch API for synchronously uploading items into the inventory

Item Batch Upload Sync API With Optimistic Locking Disabled

POST /item-storage/batch/synchronous-unsafe

Create or update (upsert) a collection of items in a single synchronous request; if any item fails the complete batch will be rejected (all or nothing). Environment variable DB_ALLOW_SUPPRESS_OPTIMISTIC_LOCKING is required, see https://github.com/folio-org/raml-module-builder#environment-variables for details. The _version property is ignored, optimistic locking is disabled - this is known to lead to data loss in some cases, don't use in production, you have been warned!

POST /item-storage/batch/synchronous-unsafe
Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A collection of item records",
  "type": "object",
  "properties": {
    "items": {
      "description": "List of item records",
      "id": "items",
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "item-storage/item.json"
      }
    }
  },
  "additionalProperties": false,
  "required": [
    "items"
  ]
}

Example:

{
  "items": [
    {
      "id": "f2901bcc-6290-417a-843b-a6d97ee9a418",
      "holdingsRecordId": "65cb2bf0-d4c2-4886-8ad0-b76f1ba75d61",
      "barcode": "456743454532",
      "status": {
        "name": "Available"
      },
      "materialTypeId": "240886da-17d9-435f-985e-21111e586fc8",
      "permanentLoanTypeId": "2e48e713-17f3-4c13-a9f8-23845bb210a4"
    },
    {
      "id": "0b96a642-5e7f-452d-9cae-9cee66c9a892",
      "holdingsRecordId": "65cb2bf0-d4c2-4886-8ad0-b76f1ba75d61",
      "barcode": "645398607547",
      "status": {
        "name": "Available"
      },
      "materialTypeId": "1a54b431-2e4f-452d-9cae-9cee66c9a892",
      "permanentLoanTypeId": "2b94c631-fca9-4892-a730-03ee529ffe27",
      "temporaryLoanTypeId": "e8b311a6-3b21-43f2-a269-dd9310cb2d0e",
      "temporaryLocationId": "0df935eb-f3f4-4741-9ac6-33c500174b96"
    }
  ]
}

Response 201

All items have been successfully created or updated

Response 413

Payload too large or not allowed by DB_ALLOW_SUPPRESS_OPTIMISTIC_LOCKING environment variable

Body

Media type: text/plain

Type: any

Example:

Payload Too Large

Response 422

Unprocessable Entity

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"
    }
  }
}

Response 500

Internal server error

Body

Media type: text/plain

Type: any

Example:

Internal server error