Errors
Packly uses conventional HTTP response codes to indicate the success or the failure of an API request.
Error response
The response will be provided with content type application/json and will contain the following fields:
- request: an object that contains all data you used on your HTTP request
- response: an object that contains the following fields:
- code: a Packly's error type
- message: a readeable message that explains the error generated by the system
- http_status_code: the HTTP status code error generated by the system
- errors: if present, this field will be an array of error elements where each element is an object composed by the following fields:
- code: a Packly's own error code that belongs to VALIDATION_ERROR, BOX_ERROR or QUANTITY_ERROR types
- path: if filled, the path of the field involved
- message: a message that describes the issue
At the moment Packly follows a fail fast approach, so the errors array will always have at most one element.
Error types
Packly defines the following error types:
- VALIDATION_ERROR
- BOX_ERROR
- QUANTITY_ERROR
- ORDER_ERROR
- PRODUCT_ERROR
- INTERNAL_SERVER_ERROR
- NOT_FOUND
VALIDATION_ERROR
- http_status_code: 400
These errors relate to input validation. These errors are listed in the specific endpoint pages.
Examples
Request
GET /v1/reseller/dieline HTTP/1.1
Authorization: Bearer eHZ6MWV2R ... o4OERSZHlPZw==
Content-Type: application/x-www-form-urlencoded;charset=UTF-8
article=s001_v0
material=SBS
width=80
depth=60
height=120
type=json
Response
{
"request": {
"uri": "/v1/reseller/dieline",
"method": "GET",
"query": {
"article": "s001_v0",
"material": "SBS",
"width": 80,
"depth": 60,
"height": 120,
"type": "json"
}
},
"response": {
"code": "VALIDATION_ERROR",
"message": "Some parameters are wrong or missing",
"http_status_code": 400,
"errors": [
{
"code": "DLN_1101",
"path": "material",
"message": "material is required and must be a valid material code"
}
]
}
}
BOX_ERROR
- http_status_code: 400
The attempt to create a box can lead to errors that fall into the following categories:
- Boundary
- Constraint
- Size
When the API performs validation, it checks for errors in the following order of precedence:
- Boundary: these errors occur when a value falls outside the allowable range or boundary. The API will return a boundary error if this type of validation fails
- Constraint: if no boundary error is found, the API checks for constraint errors. These errors occur when a value violates a specific rule or condition, such as a uniqueness constraint or a relationship between fields
- Size: lastly, if neither boundary nor constraint errors are found, the API checks for size errors. This error occurs when the size of the box exceeds the dimensions of the printing sheet. This validation ensures that the box fits within the printable area. If a size mismatch is detected, a size error will be returned
Boundary errors
These errors occur when width, depth or height exceed the minimum or the maximum allowed.
- BOX_2100: width is smaller than the minimum allowed size
- BOX_2101: width is greater than the maximum allowed size
- BOX_2102: depth is smaller than the minimum allowed size
- BOX_2103: depth is greater than the maximum allowed size
- BOX_2104: height is smaller than the minimum allowed size
- BOX_2105: height is greater than the maximum allowed size
Constraint errors
These errors occur when the relationships between width, depth and height make impossible to create a proper box.
- BOX_3100:
- message: the provided values don't allow creating a proper box
- cause: depth > width
- BOX_3101:
- message: the provided values don't allow creating a proper box
- cause: depth > width * 2
- BOX_3102:
- message: the provided values don't allow creating a proper box
- cause: height > depth && depth >= 60
- BOX_3103:
- message: the provided values don't allow creating a proper box
- cause: width <= (depth * 3) / 4
- BOX_3104:
- message: the provided values don't allow creating a proper box
- cause: height > width
- BOX_3105:
- message: the provided values don't allow creating a proper box
- cause: height > depth
- BOX_3106:
- message: the provided values don't allow creating a proper box
- cause: height > width && depth > width
- BOX_3107:
- message: the provided values don't allow creating a proper box
- cause: height > width && depth > width && depth > height
- BOX_3108:
- message: the provided values don't allow creating a proper box
- cause: height > width && depth > width && depth < height
- BOX_3109:
- message: the provided values don't allow creating a proper box
- cause: width > depth
- BOX_3110:
- message: the provided values don't allow creating a proper box
- cause: width >= depth && depth < height && height > width
- BOX_3111:
- message: the provided values don't allow creating a proper box
- cause: depth > height
- BOX_3112:
- message: the provided values don't allow creating a proper box
- cause: depth > height / 2.5
- BOX_3113:
- message: the provided values don't allow creating a proper box
- cause: width > depth && width + depth > 498.25 && width + height < 498.25
- BOX_3114:
- message: the provided values don't allow creating a proper box
- cause: width > depth && width + depth > 498.25 && width + height > 498.25 && depth + height < 498.25
- BOX_3115:
- message: the provided values don't allow creating a proper box
- cause: height < 2 * depth
- BOX_3116:
- message: the provided values don't allow creating a proper box
- cause: height > (depth * 4) / 5
- BOX_3117:
- message: the provided values don't allow creating a proper box
- cause: width < height
- BOX_3118:
- message: the provided values don't allow creating a proper box
- cause: width > 2 * depth
- BOX_3119:
- message: the provided values don't allow creating a proper box
- cause: depth > (1 / 3) * width
- BOX_3120:
- message: the provided values don't allow creating a proper box
- cause: height < width / 2
- BOX_3121:
- message: the provided values don't allow creating a proper box
- cause: (depth > width && depth >= height && height > width + 30) || (depth > width && depth < height)
- BOX_3122:
- message: the provided values don't allow creating a proper box
- cause: (depth <= width && width >= height && height > depth + 30 && depth + 30 >= 35) || (depth <= width && width < height && width >= 35)
Size error
- http_status_code: 400
This error occurs when the dieline does not fit the maximum printing sheet format.
- BOX_4100: the dieline bounding box exceeds the maximum size allowed
Examples
Request
GET /v1/reseller/dieline HTTP/1.1
Authorization: Bearer eHZ6MWV2R ... o4OERSZHlPZw==
Content-Type: application/x-www-form-urlencoded;charset=UTF-8
article=s001_v0
material=SBS300
width=80
depth=190
height=120
type=json
Response
{
"request": {
"uri": "/v1/reseller/dieline",
"method": "GET",
"query": {
"article": "s001_v0",
"material": "SBS300",
"width": 80,
"depth": 190,
"height": 120,
"type": "json"
}
},
"response": {
"code": "BOX_ERROR",
"message": "The provided values don't allow creating a proper box",
"http_status_code": 400,
"errors": [
{
"code": "BOX_3102",
"path": "",
"message": "depth cannot be more than twice width"
}
]
}
}
QUANTITY_ERROR
- http_status_code: 400
These errors occur when the number of the sheets does not reach the minimum required quantity. These errors only occur when requesting a quotation or when creating an order. Please, refer to quotation and orders pages for more detailed info.
Examples
Request
GET /v1/reseller/quotation HTTP/1.1
Authorization: Bearer eHZ6MWV2R ... o4OERSZHlPZw==
Content-Type: application/x-www-form-urlencoded;charset=UTF-8
items=[{"article":"s001_v0","material":"FBB285","width":70.66,"depth":80.77,"height":120,"references":[{"quantity":30}],"printing":"false","gold":"false","silver":"false","varnish":"false","manufacturing_time":"standard"}]
shipping=FR
Response
{
"request": {
"uri": "/v1/reseller/quotation",
"method": "GET",
"query": {
"items": "[{\"article\":\"s001_v0\",\"material\":\"FBB285\",\"width\":70.66,\"depth\":80.77,\"height\":120,\"references\":[{\"quantity\":30}],\"printing\":\"false\",\"gold\":\"false\",\"silver\":\"false\",\"varnish\":\"false\",\"manufacturing_time\":\"standard\"}]",
"shipping": "FR"
}
},
"response": {
"code": "QUANTITY_ERROR",
"message": "Quantity error",
"http_status_code": 400,
"errors": [
{
"code": "QTT_1114",
"path": "products[0]",
"message": "the number of sheets doesn't reach the minimum required quantity"
}
]
}
}
ORDER_ERROR
- http_status_code: 400, 404
This error type is used when an order is not found or it's not properly made.
Examples
Request
GET /v1/reseller/orders/2024-1722002-7034418 HTTP/1.1
Authorization: Bearer eHZ6MWV2R ... o4OERSZHlPZw==
Content-Type: application/x-www-form-urlencoded;charset=UTF-8
Response
{
"request": {
"uri": "/v1/reseller/orders/2024-1722002-7034418",
"method": "GET"
},
"response": {
"code": "ORDER_ERROR",
"message": "Order not found",
"http_status_code": 404
}
}
PRODUCT_ERROR
- http_status_code: 400, 404
This error type is used when a product is not found or it's not properly made.
Examples
Request
GET /v1/reseller/orders/2018-1533201-3892461/products/2018-1533201-3892461.01 HTTP/1.1
Authorization: Bearer eHZ6MWV2R ... o4OERSZHlPZw==
Content-Type: application/x-www-form-urlencoded;charset=UTF-8
Response
{
"request": {
"uri": "/v1/reseller/orders/2018-1533201-3892461/products/2018-1533201-3892461.01",
"method": "GET"
},
"response": {
"code": "PRODUCT_ERROR",
"message": "Product not found",
"http_status_code": 404
}
}
INTERNAL_SERVER_ERROR
- http_status_code: 500
NOT_FOUND
- http_status_code: 404