Error responses for an external data service

If the POST method call fails, the response code that the external data service returns indicates the type of error that occurred. Write the error responses for your external data service.

For example, the response code 404 Not Found indicates that the method did not find a resource, such as the class or item type. The response code 400 Bad Request indicates that a required parameter was not provided or that an incorrect value was specified for a parameter.

The JSON response that is returned by the method contains additional information about the error condition. The following example shows the format that the response uses to provide that information:
#Response
HTTP/1.1 404 Not Found
Content-Type: application/json;charset-UTF-8
{
  "userMessage":
  {
    "text":"The specified object type is not a valid object type.",
  }
  "underlyingDetails":
  {
    "causes": 
    [
      "More detailed message 1",
      "More detailed message 2",
    ]
  }
}