Common API Errors
Introduction
This section provides detailed information about common error responses you may encounter when interacting with the API. By understanding these errors and their corresponding messages, you can troubleshoot and resolve issues more effectively. Each error response includes the HTTP status code, error type, description, and an example message.
Missing Token Error
- Description: The request did not include an authorization token, or the token provided is missing or malformed.
- Resolution: Ensure that your request contains a valid authorization header with the appropriate token.
Example Response: Response
Invalid Token Error
- Description: The provided token is invalid.
- Resolution: Ensure that the token is valid and correctly formatted.
Example Response: Response
API Usage Limit Exceeded
- Description: The API usage limit for the current month has been exceeded. You may have made too many API requests in a given period.
- Resolution: Wait for the limit to reset or contact support to request an increase in your API quota.
Example Response: Response
Invalid JSON Body
- Description: The request body is either missing or malformed. This can occur when the JSON body is improperly structured, missing required fields, or entirely absent.
- Resolution: Ensure that the request body is correctly formatted in JSON and contains all required fields as specified by the API documentation.
Example Response: Response
Validation Error
- Description: The request was malformed or missing required data. This can happen when fields are missing or contain invalid values.
- Resolution: Review the request payload to ensure all required fields are included and are properly formatted. Refer to the API documentation for the correct data format.
Example Response: Response
Record Not Found
- Description: The requested record could not be found in the database. This may occur when the provided identifier (e.g., ID) does not exist or is incorrect.
- Resolution: Ensure that the record ID or identifier you provided is correct and exists in the system.
Example Response: Response
How to Handle Common Errors
When handling errors, ensure that you:
- Capture the HTTP Status Code: Each error comes with a specific HTTP status code (e.g., 401, 400, 500) that helps you identify the issue.
- Examine the Error Message: The error message provides additional details about the problem and how to resolve it.
- Review the Response Data: Some errors may include additional data (e.g., missing fields in validation errors) that can guide you in correcting the request.
For detailed information on how to structure your requests and avoid these errors, refer to the API documentation.