Even cool kids make mistakes
Encountering various errors when working with APIs is common. However, with a proper understanding of the error and its status code, troubleshooting becomes easier.
Below is a table of all possible status codes and their respective descriptions specific to the RAWG API.
Status code | Status description | Description |
---|---|---|
200 | OK | This indicates that your request was successful. |
401 | UNAUTHORIZED | Occurs when an unauthorized parameter is present, such as an incorrect API Key. |
404 | NOT FOUND | Indicates that the requested resource is not found or doesn't exist. |
By following industry standards, you can infer the nature of an error based on the status code. For example, status codes starting with 2xx
typically indicate success. Status codes in the 4xx
range signify an error, accompanied by an error message as shown in the table above. Lastly, 5xx
codes indicate server errors, although they are not common with RAWG.
Understanding status codes is one aspect. To delve deeper, it's crucial to know the meanings of various errors you might encounter as responses from the API. Below is another table for this purpose:
Error | Error Message | Description |
---|---|---|
No API Key error | The key parameter is not provided | You didn't include the API key in your request |
Wrong API Key error | The API key is not found | Incorrect API Key. |
Bad request error | Not Found | The requested resource couldn't be found on the RAWG API server. |
Page error | Invalid page | When querying the page of a game, using an inappropriate integer value, such as a negative number or a string value. |
All errors are returned in JSON format