Introduction

If any request cannot be completed the Connect API will return an error in the response. The body of the response will be of the following format:

Error Response Format
{
"httpStatusCode" : 404,
"type" : "business.rule",
"code" : "resource.not.found",
"message" : "Resource with id 100 not found",
"apiSubErrors" : [ ],
"timestamp" : "2021-05-21T00:37:28.143Z"
}
Path Type Description

httpStatusCode

Number

One of the following http status codes: 400, 404, 405, 415, 422, 500 or 502

type

String

One of the following:

1. business.rule - main resource not found or business rules failure

2. client.access - problems with the access token or you do not have permission to perform the task

3. client.validation - client sent invalid data, sub resource(s) not found or when getting the outcome of an async request and the request errored

4. remote.call - an unexpected error with one or more of the upstream services

5. server.internal - an unexpected error processing the request

code

String

A unique code that identifies the error

message

String

The error message

apiSubErrors

Array

A list of errors relating to this main error

timestamp

String

The date time the error occurred

apiSubErrors contains errors related to the main error and has one of the the following format:

  1. Validation Errors

    Sub Errors Validation Error Response Format
      "apiSubErrors" : [ {
        "code" : "constraints.ordering.technology.type.not.available",
        "message" : "Online ordering only available for tc4",
        "object" : "CreateOrderCommand",
        "field" : "trafficClass",
        "rejectedValue" : "tc2"
      } ],
    Path Type Description

    code

    String

    A unique code that identifies the error

    message

    String

    The error message

    object

    String

    The object the error is related to

    field

    String

    The field the error is related to

    rejectedValue

    String

    The value that was rejected

  2. Detail Errors

    Sub Errors Detail Error Response Format
    "apiSubErrors":[
    {
    "code":"malformed.json.request"
    "message":"A Checked Exception Occurred",
    }
    ],
    Path Type Description

    code

    String

    A unique code that identifies the error

    message

    String

    The error message

Example Error Responses

Type is business.rule

Business Error

Response
HTTP/1.1 404 Not Found

{
  "httpStatusCode" : 404,
  "type" : "business.rule",
  "code" : "resource.not.found",
  "message" : "Resource with id 100 not found",
  "apiSubErrors" : [ ],
  "timestamp" : "2025-03-11T22:29:01.10892458Z"
}

Type is client.access

Access Denied Error

Response
HTTP/1.1 404 Not Found

{
  "httpStatusCode" : 404,
  "type" : "client.access",
  "code" : "access.denied",
  "message" : "Access Denied",
  "apiSubErrors" : [ ],
  "timestamp" : "2025-03-11T22:28:50.192181879Z"
}

Type is client.validation

Bind Error

Response
HTTP/1.1 422 Unprocessable Entity

{
  "httpStatusCode" : 422,
  "type" : "client.validation",
  "code" : "bind",
  "message" : "Validation error",
  "apiSubErrors" : [ {
    "code" : "constraints.not.blank",
    "message" : "must not be blank",
    "object" : "createCommand",
    "field" : "fieldOne",
    "rejectedValue" : null
  } ],
  "timestamp" : "2025-03-11T22:28:52.381294047Z"
}

Constraint Violation Error

Response
HTTP/1.1 422 Unprocessable Entity

{
  "httpStatusCode" : 422,
  "type" : "client.validation",
  "code" : "validation",
  "message" : "Validation error",
  "apiSubErrors" : [ {
    "code" : "constraints.ordering.technology.type.not.available",
    "message" : "Online ordering only available for tc4",
    "object" : "CreateOrderCommand",
    "field" : "trafficClass",
    "rejectedValue" : "tc2"
  } ],
  "timestamp" : "2025-03-11T22:28:53.457398364Z"
}

Http Media Type Not Supported Error

Response
HTTP/1.1 415 Unsupported Media Type

{
  "httpStatusCode" : 415,
  "type" : "client.validation",
  "code" : "http.media.type.not.supported",
  "message" : "Content type 'text/plain' not supported",
  "apiSubErrors" : [ ],
  "timestamp" : "2025-03-11T22:29:03.280720196Z"
}

Http Request Method Not Supported Error

Response
HTTP/1.1 405 Method Not Allowed

{
  "httpStatusCode" : 405,
  "type" : "client.validation",
  "code" : "http.request.method.not.supported",
  "message" : "Request method 'DELETE' not supported",
  "apiSubErrors" : [ ],
  "timestamp" : "2025-03-11T22:28:56.742907203Z"
}

Method Argument Not Valid Error

Response
HTTP/1.1 422 Unprocessable Entity

{
  "httpStatusCode" : 422,
  "type" : "client.validation",
  "code" : "method.argument.not.valid",
  "message" : "Validation error",
  "apiSubErrors" : [ {
    "code" : "constraints.not.blank",
    "message" : "must not be blank",
    "object" : "createCommand",
    "field" : "fieldOne",
    "rejectedValue" : ""
  }, {
    "code" : "constraints.size",
    "message" : "size must be between 0 and 5",
    "object" : "createCommand",
    "field" : "fieldTwo",
    "rejectedValue" : "1234567890"
  } ],
  "timestamp" : "2025-03-11T22:28:58.938168925Z"
}

Method Argument Type Mismatch Error

Response
HTTP/1.1 400 Bad Request

{
  "httpStatusCode" : 400,
  "type" : "client.validation",
  "code" : "method.argument.type.mismatch",
  "message" : "Failed to convert value of type 'java.lang.String' to required type 'java.lang.Long'; nested exception is java.lang.NumberFormatException: For input string: \"AAAA\"",
  "apiSubErrors" : [ ],
  "timestamp" : "2025-03-11T22:29:00.00653313Z"
}

Missing Path Variable Error

Response
HTTP/1.1 400 Bad Request

{
  "httpStatusCode" : 400,
  "type" : "client.validation",
  "code" : "missing.path.variable",
  "message" : "Required URI template variable 'testId' for method parameter type int is not present",
  "apiSubErrors" : [ ],
  "timestamp" : "2025-03-11T22:28:49.126815217Z"
}

Missing Servlet Request Parameter Error

Response
HTTP/1.1 400 Bad Request

{
  "httpStatusCode" : 400,
  "type" : "client.validation",
  "code" : "missing.servlet.request.parameter",
  "message" : "Required request parameter 'fileType' for method parameter type String is not present",
  "apiSubErrors" : [ ],
  "timestamp" : "2025-03-11T22:28:51.277030233Z"
}

Missing Servlet Request Part Error

Response
HTTP/1.1 400 Bad Request

{
  "httpStatusCode" : 400,
  "type" : "client.validation",
  "code" : "missing.servlet.request.part",
  "message" : "Required request part 'file' is not present",
  "apiSubErrors" : [ ],
  "timestamp" : "2025-03-11T22:28:55.646319299Z"
}

Validation Error

Response
HTTP/1.1 422 Unprocessable Entity

{
  "httpStatusCode" : 422,
  "type" : "client.validation",
  "code" : "validation",
  "message" : "Validation error",
  "apiSubErrors" : [ {
    "code" : "constraints.ordering.technology.type.not.available",
    "message" : "Online ordering only available for tc4",
    "object" : "CreateOrderCommand",
    "field" : "trafficClass",
    "rejectedValue" : "tc2"
  } ],
  "timestamp" : "2025-03-11T22:28:53.457398364Z"
}

Type is remote.call

BadGateway Error

Response
HTTP/1.1 502 Bad Gateway

{
  "httpStatusCode" : 502,
  "type" : "remote.call",
  "code" : "remote.call.error",
  "message" : "There was an unexpected error with one or more of the upstream services",
  "apiSubErrors" : [ ],
  "timestamp" : "2025-03-11T22:28:54.505596613Z"
}

Type is server.internal

Server Error

Response
HTTP/1.1 500 Internal Server Error

{
  "httpStatusCode" : 500,
  "type" : "server.internal",
  "code" : "server.internal.error",
  "message" : "There was an unexpected error processing the request",
  "apiSubErrors" : [ ],
  "timestamp" : "2025-03-11T22:29:02.205921023Z"
}