Pieces (v1)

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

Table of contents

Orders Business Logic API

API for managing pieces

Pieces

Create piece record

POST /orders/pieces

Create piece record

POST /orders/pieces
Query Parameters
  • lang: (string - default: en - pattern: [a-zA-Z]{2})

    Requested language. Optional. [lang=en]

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Piece details",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of this piece 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}$"
    },
    "caption": {
      "description": "Volume/enumeration information",
      "type": "string"
    },
    "comment": {
      "description": "Free form commentary",
      "type": "string"
    },
    "format": {
      "description": "The format of the piece",
      "type": "string",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "enum": [
        "Physical",
        "Electronic",
        "Other"
      ]
    },
    "itemId": {
      "description": "UUID of the associated item 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}$"
    },
    "locationId": {
      "description": "UUID of the (inventory) location 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}$"
    },
    "poLineId": {
      "description": "UUID of the purchase order line this record is associated with",
      "$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}$"
    },
    "titleId": {
      "description": "UUID of the title 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}$"
    },
    "receivingStatus": {
      "description": "the status of this piece",
      "type": "string",
      "enum": [
        "Received",
        "Expected"
      ],
      "default": "Expected"
    },
    "supplement": {
      "description": "Whether or not this is supplementary material",
      "type": "boolean"
    },
    "receiptDate": {
      "description": "Date that associated item is expected to arrive",
      "type": "string",
      "format": "date-time"
    },
    "receivedDate": {
      "description": "The date associated item is actually received",
      "type": "string",
      "format": "date-time"
    }
  },
  "additionalProperties": false,
  "required": [
    "format",
    "poLineId",
    "titleId",
    "receivingStatus"
  ]
}

Example:

{
  "caption": "Tutorial Volume 5",
  "comment": "Special Edition",
  "format": "Electronic",
  "itemId": "522a501a-56b5-48d9-b28a-3a8f02482d97",
  "locationId": "53cf956f-c1df-410b-8bea-27f712cca7c0",
  "poLineId": "d471d766-8dbb-4609-999a-02681dea6c22",
  "titleId": "9a665b22-9fe5-4c95-b4ee-837a5433c95d",
  "receivingStatus": "Expected",
  "supplement": true,
  "receiptDate": "2018-10-11T00:00:00.000Z"
}

Response 201

Returns processing result of the pieces

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Piece details",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of this piece 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}$"
    },
    "caption": {
      "description": "Volume/enumeration information",
      "type": "string"
    },
    "comment": {
      "description": "Free form commentary",
      "type": "string"
    },
    "format": {
      "description": "The format of the piece",
      "type": "string",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "enum": [
        "Physical",
        "Electronic",
        "Other"
      ]
    },
    "itemId": {
      "description": "UUID of the associated item 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}$"
    },
    "locationId": {
      "description": "UUID of the (inventory) location 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}$"
    },
    "poLineId": {
      "description": "UUID of the purchase order line this record is associated with",
      "$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}$"
    },
    "titleId": {
      "description": "UUID of the title 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}$"
    },
    "receivingStatus": {
      "description": "the status of this piece",
      "type": "string",
      "enum": [
        "Received",
        "Expected"
      ],
      "default": "Expected"
    },
    "supplement": {
      "description": "Whether or not this is supplementary material",
      "type": "boolean"
    },
    "receiptDate": {
      "description": "Date that associated item is expected to arrive",
      "type": "string",
      "format": "date-time"
    },
    "receivedDate": {
      "description": "The date associated item is actually received",
      "type": "string",
      "format": "date-time"
    }
  },
  "additionalProperties": false,
  "required": [
    "format",
    "poLineId",
    "titleId",
    "receivingStatus"
  ]
}

Example:

{
  "id": "5e317dc2-deeb-4429-b2a1-91e5cd0fd5f7",
  "caption": "Tutorial Volume 5",
  "comment": "Special Edition",
  "format": "Electronic",
  "itemId": "522a501a-56b5-48d9-b28a-3a8f02482d97",
  "locationId": "53cf956f-c1df-410b-8bea-27f712cca7c0",
  "poLineId": "d471d766-8dbb-4609-999a-02681dea6c22",
  "titleId": "9a665b22-9fe5-4c95-b4ee-837a5433c95d",
  "receivingStatus": "Expected",
  "supplement": true,
  "receiptDate": "2018-10-11T00:00:00.000Z"
}

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

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

PUT /orders/pieces/{id}

Update a piece record with given {id}

PUT /orders/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

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

    Requested language. Optional. [lang=en]

Body

Media type: application/json

Type: json

Content:

{
  "$schema": "http://json-schema.org/draft-04/schema#",
  "description": "Piece details",
  "type": "object",
  "properties": {
    "id": {
      "description": "UUID of this piece 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}$"
    },
    "caption": {
      "description": "Volume/enumeration information",
      "type": "string"
    },
    "comment": {
      "description": "Free form commentary",
      "type": "string"
    },
    "format": {
      "description": "The format of the piece",
      "type": "string",
      "$schema": "http://json-schema.org/draft-04/schema#",
      "enum": [
        "Physical",
        "Electronic",
        "Other"
      ]
    },
    "itemId": {
      "description": "UUID of the associated item 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}$"
    },
    "locationId": {
      "description": "UUID of the (inventory) location 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}$"
    },
    "poLineId": {
      "description": "UUID of the purchase order line this record is associated with",
      "$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}$"
    },
    "titleId": {
      "description": "UUID of the title 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}$"
    },
    "receivingStatus": {
      "description": "the status of this piece",
      "type": "string",
      "enum": [
        "Received",
        "Expected"
      ],
      "default": "Expected"
    },
    "supplement": {
      "description": "Whether or not this is supplementary material",
      "type": "boolean"
    },
    "receiptDate": {
      "description": "Date that associated item is expected to arrive",
      "type": "string",
      "format": "date-time"
    },
    "receivedDate": {
      "description": "The date associated item is actually received",
      "type": "string",
      "format": "date-time"
    }
  },
  "additionalProperties": false,
  "required": [
    "format",
    "poLineId",
    "titleId",
    "receivingStatus"
  ]
}

Example:

{
  "id": "5e317dc2-deeb-4429-b2a1-91e5cd0fd5f7",
  "caption": "Tutorial Volume 5",
  "comment": "Special Edition",
  "format": "Electronic",
  "itemId": "522a501a-56b5-48d9-b28a-3a8f02482d97",
  "locationId": "53cf956f-c1df-410b-8bea-27f712cca7c0",
  "poLineId": "d471d766-8dbb-4609-999a-02681dea6c22",
  "titleId": "9a665b22-9fe5-4c95-b4ee-837a5433c95d",
  "receivingStatus": "Expected",
  "supplement": true,
  "receiptDate": "2018-10-11T00:00:00.000Z"
}

Response 204

Piece record successfully updated

Response 400

Bad request

Body

Media type: application/json

Type: any

Example:

{
  "errors": [
    {
      "message": "Bad URL request",
      "code": "pieceNotFound"
    }
  ]
}

Media type: text/plain

Type: any

Example:

unable to create Piece -- Bad request

Response 404

Request id does not exists

Body

Media type: application/json

Type: any

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": "Internal server error, contact administrator",
      "code": "genericError"
    }
  ]
}

Media type: text/plain

Type: any

Example:

unable to create Piece -- Internal server error, e.g. due to misconfiguration

DELETE /orders/pieces/{id}

Delete a piece with given {id}

DELETE /orders/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

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

    Requested language. Optional. [lang=en]

Response 204

Piece record successfully deleted

Response 400

Bad request

Body

Media type: application/json

Type: any

Example:

{
  "errors": [
    {
      "message": "Bad URL request",
      "code": "pieceNotFound"
    }
  ]
}

Media type: text/plain

Type: any

Example:

unable to delete Piece -- Bad request

Response 404

Request id does not exists

Body

Media type: application/json

Type: any

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": "Internal server error, contact administrator",
      "code": "genericError"
    }
  ]
}

Media type: text/plain

Type: any

Example:

unable to delete Piece -- Internal server error, e.g. due to misconfiguration