JSON API

Errors

4min

Merchants are responsible for ensuring the accuracy of the data they submit. This includes checking for:

  • Leading and trailing spaces included in the submitted data are considered valid and are retained during processing in our backend.
  • Special characters included in the submitted data are properly escaped to ensure compatibility with JSON format.
  • HTML formatting in descriptions or short descriptions is correctly escaped to prevent unintended rendering issues.
  • The startPrice and toPrice are calculated only when not explicitly submitted for all variants within a given complex product.

At Klevu.com, we utilize conventional HTTP response codes to convey the outcome of API requests.

  • Responses in the 2xx range signify successful operations.
  • Responses in the 4xx range denote errors stemming from the provided information, such as missing required parameters or failed requests.
  • Responses in the 5xx range signify issues with Klevu's servers, though these are uncommon.
JSON


Understanding the error response:

Parameters

Description

status

HTTP status codes: 400,401, 405, 413, 415, 500, 502, 503, 504

code

The type of error returned. please see below reference table below for more information.

message

A brief overview of the error.

debug

A comprehensive breakdown of the error, highlighting the reason for the issue along with specific details regarding the record causing the error.

Error Message Illustrations:

status

code

message

debug

400

VALIDATION_ERROR

The request was invalid. Please check the provided payload for errors.

[ {"id":"1233AD","message":"Attribute: brand is undefined."} ]

400

INVALID_REQUEST

The request was invalid. Please check the provided payload for errors.

[ { "message": "The store is currently configured to use XML Data Indexing APIs. Before you can begin using the new JSON endpoint, a backend migration is required. Please submit a support ticket at https://help.klevu.com/support/tickets/new to request assistance with the backend migration process."} ]

401

AUTHENTICATION_ERROR

Authentication failed. Please ensure your credentials are valid and try again.

[{"message":"The supplied credentials are invalid."} ]

405

METHOD_NOT_ALLOWED

The request method is not allowed.

[ {"message":"Please ensure you are using a valid request method for this endpoint. The allowed methods are GET/POST/DELETE."} ]

413

CONTENT_TOO_LARGE

The batch content in the request exceeds the allowable size limit for processing.

[{"message" : "The request content is too large. The maximum allowed size is 2MB."}]

415

UNSUPPORTED_MEDIA_TYPE

The request Content-Type is not allowed.

[ {"message": "The request header Content-Type: text/plain is not supported for this endpoint." }]

500/502/ 503/504

SERVER_ERROR

Something went wrong on Klevu’s end.

[{"message":"Something went wrong on Klevu’s end. Please contact Klevu support at https://help.klevu.com/support/tickets/new" }]





Updated 17 Mar 2024
Doc contributor
Did this page help you?