Bind Pieces (v1)

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

Table of contents

Orders Business Logic API

API for binding pieces with item for one title

Bind pieces

This endpoint is used to bind pieces to one item and connect that item to a title.

POST /orders/bind-pieces

bind pieces to item and connect that item to title

POST /orders/bind-pieces
Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "A collection of binding pieces",
  "type": "object",
  "properties": {
    "poLineId": {
      "description": "The id of the binding PoLine",
      "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}$"
    },
    "instanceId": {
      "description": "The id of the instance associated with PoLine",
      "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}$"
    },
    "bindItem": {
      "description": "The new binding item details",
      "type": "object",
      "properties": {
        "barcode": {
          "type": "string",
          "description": "Barcode is the descriptive information for the barcode of a serial. Synchronized with inventory item."
        },
        "materialTypeId": {
          "description": "UUID of the material type",
          "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}$"
        },
        "callNumber": {
          "type": "string",
          "description": "CallNumber is the descriptive information for the call number of a serial. Synchronized with inventory item."
        },
        "permanentLoanTypeId": {
          "description": "UUID of the permanent loan type",
          "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}$"
        },
        "locationId": {
          "description": "UUID of the location Id",
          "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}$"
        },
        "holdingId": {
          "description": "UUID of the holding Id",
          "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}$"
        },
        "tenantId": {
          "description": "ID of the Tenant where the item should be created in",
          "type": "string"
        }
      },
      "additionalProperties": false
    },
    "bindPieceIds": {
      "description": "A collection of IDs of binding piece records",
      "type": "array",
      "id": "bindPieceIds",
      "items": {
        "type": "string",
        "$schema": "http://json-schema.org/draft-04/schema#",
        "description": "The UUID format 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}$"
      }
    },
    "requestsAction": {
      "description": "Action to determine whether the open circulation requests should be transferred to a new item or not",
      "type": "object",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "enum": [
        "Transfer",
        "Cancel",
        "Do Nothing"
      ]
    }
  },
  "additionalProperties": false,
  "required": [
    "poLineId",
    "bindItem",
    "bindPieceIds"
  ]
}

Example:

{
  "poLineId": "3f4f61ab-d3c2-47a9-baa6-c903a4cfba57",
  "instanceId": "c0d08448-347b-418a-8c2f-5fb50248d67e",
  "bindItem": {
    "barcode": "0987654111",
    "materialTypeId": "a058cb27-a77d-4cb3-b76b-2adc931fb0c9",
    "callNumber": "BF2050 .M335 2000",
    "permanentLoanTypeId": "41673a86-ebab-4a5a-8b1b-76110a6f86f4",
    "holdingId": "0804ddec-6545-404a-b54d-a693f505681d",
    "tenantId": "diku"
  },
  "bindPieceIds": [
    "fe729e0b-5c56-4f0a-bb3a-33bc405d71a0",
    "4d6b8cf9-73bd-4b3d-8f1b-5b7cbf02d03a"
  ],
  "requestsAction": "Transfer"
}

Response 200

Returns processing result of the bind-pieces

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Result of Binding Pieces",
  "type": "object",
  "properties": {
    "poLineId": {
      "description": "The id of the PoLine associated with bound pieces",
      "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}$"
    },
    "boundPieceIds": {
      "description": "A collection of IDs of Piece that were bound",
      "type": "array",
      "id": "boundPieceIds",
      "items": {
        "type": "string",
        "$schema": "http://json-schema.org/draft-04/schema#",
        "description": "The UUID format 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}$"
      }
    },
    "itemId": {
      "description": "The id of the new item created",
      "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}$"
    }
  },
  "additionalProperties": false,
  "required": [
    "poLineId",
    "boundPieceIds"
  ]
}

Example:

{
  "poLineId": "3f4f61ab-d3c2-47a9-baa6-c903a4cfba57",
  "boundPieceIds": [
    "fe729e0b-5c56-4f0a-bb3a-33bc405d71a0",
    "4d6b8cf9-73bd-4b3d-8f1b-5b7cbf02d03a"
  ],
  "itemId": "4d6b8cf9-4b3d-d3c2-5c56-c923bf025b7c"
}

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: application/json

Type: any

Example:

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

Media type: text/plain

Type: any

Example:

"unable to update bind-piece -- malformed JSON at 13:4"

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: application/json

Type: any

Example:

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

Media type: text/plain

Type: any

Example:

internal server error, contact administrator

DELETE /orders/bind-pieces/{id}

Remove binding for a piece with given {id}

DELETE /orders/bind-pieces/{id}
URI Parameters
  • id: required (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}$)

    The UUID of a piece record

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