Skip to main content

Error Handling & Faq

In this section, we aim to help users understand and troubleshoot errors that may arise while using the Miragek Quote API.

Common Error Codes and Their Meanings ⚠️

Here are some of the common error codes you may encounter:

Take care
  • 400 Bad Request: The request was invalid. Check your parameters and try again.
  • 401 Unauthorized: The API key is missing or invalid.
  • 403 Forbidden: You do not have permission to access the requested resource.
  • 404 Not Found: The endpoint you are trying to access does not exist.
  • 429 Too Many Requests: You have exceeded your rate limit. Please wait and try again later.
  • 500 Internal Server Error: An unexpected error occurred on the server side.

Example Error Responses

When an error occurs, the API will return a response in the following format:

Example 400 Error Response

{
"error": {
"code": 400,
"message": "Invalid request parameters."
}
}

Example 401 Error Response

{
"error": {
"code": 401,
"message": "Unauthorized. Please provide a valid API key."
}
}

Tips for Avoiding and Resolving Errors

  • Validate Input: Always validate your input parameters before making requests to avoid 400 errors.
  • Check API Key: Ensure your API key is correct and has the necessary permissions.
  • Monitor Rate Limits: Keep an eye on your rate limits to prevent 429 errors.
  • Review Documentation: Refer to the API documentation for any updates or changes.

Debugging Techniques

If you encounter errors, here are some techniques to help you debug:

  • Console Logging: Use console logs to capture request and response data.
  • Inspect Network Activity: Use browser developer tools to inspect network activity and responses.
  • Test with Tools: Utilize tools like Postman or cURL to manually test your API calls.

FAQ ❓

This section addresses common questions and issues that users may have regarding the Miragek Quote API.

How to Get a New API Key if Lost

If you lose your API key, follow these steps to obtain a new one:

  1. Log in to your account on the Miragek website.
  2. Navigate to the API section in your dashboard.
  3. Click on "Generate New API Key" to create a new key.
  4. Make sure to store the new key securely.

Troubleshooting Tips for Common Issues

  • Cannot Access Quotes: Ensure you are using the correct endpoint and your API key is valid.
  • Error 429: If you receive this error, reduce the frequency of your requests and implement rate limiting in your application.
  • Invalid Parameters: Double-check your query parameters to ensure they match the API's requirements.

Best Practices for Using the API Efficiently

  • Batch Requests: Where possible, batch your requests to reduce the number of API calls.
  • Use Caching: Cache responses for frequently requested data to improve performance.
  • Stay Informed: Keep up with updates to the API documentation for new features and changes.