Errors
In this guide, we will talk about what happens when something goes wrong while working with the Merlin API.
You can tell if your request was successful by checking the status code and meta object contained in the response from the API. If a response comes back unsuccessful, you can use the meta object to figure out what has gone wrong. Let's look at some status codes and error types you might encounter.
Status Codes
Here is a list of different categories of status codes returned by the Merlin API. Use these to understand if a request was successful.
A 2xx status code indicates a successful response.
A 4xx status code indicates a client error, this is due to an error in your request. Most often it is a missing or expired bearer token problem.
A 5xx status code indicates a server error.
Error Types
Whenever a request is successful or unsuccessful, the Merlin API will return an meta response with a description of the result (if one is available). You can use this information to understand better what has gone wrong and how to fix it. Most of the error messages are pretty helpful and actionable.
If true, then warnings occurred while processing your request.
If true, then an error occurred while processing your request.
The transaction was successful, but an adverse condition occurred while processing the request.
An array of one or more errors.
Meta Response