All Release Notes

Error status code 400 for POST request

7 December 2021
Composable Commerce
HTTP API
Enhancement
General

As announced on 5 November 2021, we introduced a HTTP status code 400 for errors in all Import API POST endpoints.

The following change was made:

  • In case one or more resources in an Import Request is invalid, the Import API endpoints respond with statusCode: 400:

    {
    "statusCode": 400,
    "error": "Bad Request",
    "message": "Complete request got rejected. Import request has some invalid fields",
    "errors": [
    {
    "code": "InvalidField",
    "message": "\"resources[1].key\" is required",
    "field": "resources.1.key",
    "resourceIndex": 1
    },
    .
    .
    .
    ]
    }

The response code remains the same in the following cases:

  • In case the JSON payload of an Import Request is invalid, the Import API will continue to respond with statusCode": 400.
  • In case all the resources in am Import Request are valid, the Import API will continue to respond with statusCode": 200.