Skip to content

Handling API errors ​

When making API requests in Wized, errors can occur for various reasons. These errors generally fall into two categories:

  1. The request was not sent – The request never reached the API server.
  2. The request was sent but returned an error – The API responded with an error message.

Understanding the cause of these errors will help you diagnose and fix them efficiently.


When the request cannot be sent ​

If the request is not sent, it means it never reached the API server. This can happen due to:

  • Incorrect configuration in Wized

    Double-check the request configuration in the Requests panel. Ensure the endpoint URL, HTTP method, headers, and body match the API requirements.

  • CORS

    Some APIs do not accept requests from browsers for security reasons. By default, Wized sends requests from the browser, which can cause issues in these cases.

How to troubleshoot ​

To determine if the request is failing before reaching the API:

  1. Check the logs

    • If the request was not sent, you might see a 500 - Failed to Fetch error in the data store panel under the "States" tab.
  2. Review your request configuration

    • Ensure the endpoint URL, HTTP method, headers, and body are correctly set in the Requests panel.
  3. Verify API availability

    • Visit the API provider’s status page or check online for service interruptions.
  4. Use secrets or native integrations

    • If the API blocks direct browser requests, use the Secrets feature in Wized to send requests through our servers.
    • Alternatively, check if Wized has a native integration with the service, as these integrations manage API communication securely.

When the request returns an error ​

If the request is successfully sent but the API returns an error, the response will include an HTTP status code that indicates what went wrong.

Common API error codes ​

  • 400 Bad Request – The request is malformed or missing required data.
  • 401 Unauthorized – Authentication is required but missing or incorrect.
  • 403 Forbidden – The request is valid, but you lack the necessary permissions.
  • 404 Not Found – The requested resource does not exist.
  • 500 Internal Server error – The API encountered an unexpected issue.

View code list

How to troubleshoot ​

  1. Check the HTTP status code

    • In the data store panel, look at the status code in the "Statuses" tab.
    • Use API documentation or online references to understand the meaning of the error.
  2. Examine the response body

    • Some APIs provide detailed error messages inside the response body.
    • Check the "Body" tab in the data Store Panel for additional details.
  3. Consult the API documentation

    • API documentation will clarify possible causes and solutions for specific errors.