Error Handling
When interacting with the Storeino API, errors are communicated using standard HTTP status codes and a consistent error response format. This helps you quickly identify and resolve issues in your integration.
Error Response Format
All error responses return a JSON object with the following structure:
json
{
"status": "error",
"message": "A human-readable description of the error.",
"errors": {
"field_name": [
"Error message related to the field."
]
}
}- status: Always
"error"for failed requests. - message: A brief description of the error.
- errors: (optional) An object containing field-specific validation errors.
Example Error Responses
Validation Error
json
{
"status": "error",
"message": "The given data was invalid.",
"errors": {
"email": [
"The email field is required."
]
}
}Authentication Error
json
{
"status": "error",
"message": "Unauthenticated."
}Not Found Error
json
{
"status": "error",
"message": "Resource not found."
}Common HTTP Status Codes
| Status Code | Meaning | Description |
|---|---|---|
| 400 | Bad Request | The request was invalid or cannot be served. |
| 401 | Unauthorized | Authentication failed or missing. |
| 403 | Forbidden | You do not have permission to access. |
| 404 | Not Found | The requested resource does not exist. |
| 422 | Unprocessable Entity | Validation failed for the request data. |
| 429 | Too Many Requests | Rate limit exceeded. |
| 500 | Internal Server Error | An error occurred on the server. |
Handling Errors
- Always check the HTTP status code and the error message in the response.
- For validation errors (
422), inspect theerrorsobject for details about which fields failed. - For authentication errors (
401), ensure your API key or token is valid and included in the request headers. - If you encounter a
429error, wait before making more requests.
Need Help?
If you need further assistance, please contact our support team at support@storeino.com.