Errors
In this guide, we will talk about what happens when something goes wrong while you work with the API or n8n. Let's look at some status codes and error types you might encounter.
You can tel
Status codes
Here is a list of the different categories of status codes returned by the Countertop Studio API. Use these to understand if a request was successful.
- Name
2xx- Description
A 2xx status code indicates a successful response.
- Name
4xx- Description
A 4xx status code indicates a client error — this means it's a you problem.
- Name
5xx- Description
A 5xx status code indicates a server error — this means something went wrong on our end.
Error types
Whenever a request is unsuccessful, the Countertop Studio API will return an error response with an error message. You can use this information to understand better what has gone wrong and how to fix it.
Validation errors
In case you do send a request with invalid data, you will receive a 422 status code with a response body that looks like this:
- Name
message- Description
Will only return "validation error" for validation errors, so you can check for this message or the status code 422 to identify validation errors in your code.
- Name
errors- Description
Contains a list of all validation errors that occurred. Each key is the name of the field that caused the error, and the value is an array of error messages related to that field.
Validation error response
{
"message": "validation error",
"errors": {
"last_name": [
"The last name field is required."
]
}
}
Bad requests
In case you do send a request with invalid data, you will receive a 400 status code.
Internal Server errors
In case an internal server request error occurs, you will receive a 5xx status code.