API Error codes

Listing of API error codes and their meanings:

  1. 400 Bad Request Error
  2. 401 Unauthorized Error
  3. 403 Forbidden Error
  4. 404 Not Found Error
  5. 406 Not Acceptable
  6. 408 Request Timeout Error
  7. 500 Internal Server Error
  8. 502 Bad Gateway Error
  9. 504 Gateway Timeout Error
  10. 505 HTTP Version Not Supported Error
  11. 507 Insufficient Storage Error
  12. 508 Loop Detected Error

 

1. 400 Bad Request Error:

This error is one of the most commonly encountered API errors, and it occurs when a server can’t parse the request itself. This could be caused by an incorrect URL, something wrong with how the API request was composed, or even an issue within the application itself.

To troubleshoot this issue, start by examining the URL and ensuring it looks correct. Then, check your API request's syntax to ensure everything is formatted correctly. If this doesn't solve the issue, you should go back into the application and search for any obvious errors.

 

2. 401 Unauthorised Error:

This API error occurs when a server cannot authorize the user’s credentials. This could be caused by an incorrect username or password or even a lack of permission access.

Check the supplied (encrypted) API Key details and ensure that this is (128 characters) in length, sometimes an issue can occur if you have copied and pasted this from the source into your set up.

Also ensure that the URL entered is correct, as well as checking if it is for the expected environment (UAT or Production). 

To troubleshoot this API error, start by confirming that your username and password are correct. If they are correct and you’re still receiving the error, then it could be a permissions issue; if so, contact your API provider for further assistance.

 

3. 403 Forbidden Error:

This API error occurs when a server refuses to fulfil a request from the client due to authorization issues or other restrictions put in place by the API provider.

To troubleshoot this API error, ensure you have adequate permissions for making requests on the API endpoints in question. Then, check the API documentation to make sure that you’re sending valid data parameters with your requests. Finally, verify that no external restrictions are in place that may be blocking access to the API endpoints in question.

 

4. 404 Not Found Error:

This API error occurs when a server can’t locate the requested resource from the API provider. This could be caused by an incorrect URL or something wrong with how the API request was composed.

To troubleshoot this API error, start by verifying that the URL is correct. It’s also important to check the API documentation to make sure that you’re using the correct data parameters with your requests. Finally, contact your API provider for further assistance if all else fails.

 

5. 406 Not Acceptable:

This API error generally occurs, when the server cannot fulfil the client's request due to a problem with the requested resource, the request headers, or the server configuration.

To diagnose and resolve a 406 error, inspect the HTTP string that you are trying to run whilst sending. This will either consist of an anomaly, or you will ideally need to double check the API Method used or the Parameters, Body and Variable values to ensure these are valid beforehand.

 

6. 408 Request Timeout Error:

This API error occurs when a server doesn’t receive a response from the client within a specified amount of time and that the connection has been terminated.

To troubleshoot this API error, double-check that the URI is correct, check your internet connection, reload the page, or check your web server's timeout settings.

 

7. 500 Internal Server Error:

This API error occurs when a server encounters an unexpected condition that prevents it from fulfilling the API request. This could be caused by an issue with the API provider’s internal systems or there could be something wrong with how the API request was composed.

To troubleshoot this API error, check the API documentation to ensure that you send valid data parameters with your requests. Then, contact your API provider for further assistance in resolving any underlying issues within their internal systems.

 

8. 502 Bad Gateway Error:

This API error occurs when a server acts as a proxy and receives an invalid response from another upstream server. This could be caused by the domain name not resolving to the correct IP, the server is not reachable, or the firewire blocking the communication. To troubleshoot this API error, check your domain name, verify that your server is reachable, or check your firewall logs.

 

9. 504 Gateway Timeout Error:

This API error occurs when a server acts as a proxy and doesn’t receive a response from another server upstream within a specified time. This could be caused by an issue with internet connectivity or something wrong with how the API request was composed.

To troubleshoot this API error, first, verify that your internet connection is functioning properly and then check the API documentation to make sure that you’re sending valid data parameters with your requests.

 

10. 505 HTTP Version Not Supported Error:

This API error occurs when a server doesn’t support the client's requested version of the HTTP protocol.

To troubleshoot this API error, verify that you are using a supported version of the HTTP protocol (usually 1.1). Then, contact your API provider for further assistance in resolving any underlying issues within their internal systems.

 

11. 507 Insufficient Storage Error:

This API error occurs when there isn’t enough storage space available on a server to fulfil an API request.

To troubleshoot this API error, you could raise the standard hosting package you have or try optimizing the repositories if there's excess page traffic.

 

12. 508 Loop Detected Error:

This API error occurs when a server identifies an infinite loop (a cycle of API requests). This could be caused by too many redirects in a chain that prevents the requested resources or URL from rendering.

To troubleshoot this API error, try to identify which API calls are causing the loop, then contact your API provider for additional assistance in resolving any underlying issues.

 

Note: Summary of API Common Errors:

API errors can be caused by multiple factors ranging from server-level issues to incorrect API requests. It’s important to understand the most common API errors and how they can be identified for troubleshooting.

Additionally, it’s always a good idea to make sure that your internet connection is functioning properly before attempting to troubleshoot API errors, as this could influence the outcome of some API requests. Lastly, it’s also important to regularly monitor the performance of your APIs to detect API errors early and mitigate their impact on your users.

When API errors are handled properly, they can be resolved quickly with minimal disruption to your API clients. With this guide, you should better understand the most common API errors and how they can be identified and troubleshot.