Error handling
When working with the GBG GO API, you might encounter errors due to incorrect requests, authentication issues, or temporary service disruptions. Understanding common errors and how to troubleshoot them will help you resolve integration problems quickly.
Why API errors occur
API errors can happen for several reasons, including:
- Missing or incorrect authentication credentials
- Invalid request parameters or incorrect data formats
- Attempting to access a resource without proper permissions
- Calling an incorrect endpoint or using the wrong HTTP method
- Temporary service outages or maintenance periods
Common API errors and what they mean
The GBG GO API returns standard HTTP status codes to indicate whether a request was successful or failed. Below are common errors, why they happen, and how to fix them:
-
400 Bad request
The request is invalid or missing required parameters. This usually happens if the request body is not formatted correctly or a required field is missing.
Fix: Check your request body, confirm all required fields are included, and verify the expected data format. -
401 Unauthorized
The request does not include a valid authentication token, or the token has expired.
Fix: Make sure you have included the Bearer token in theAuthorization
header. If the token has expired, follow the Authentication guide to generate a new one. -
403 Forbidden
The API key or user does not have permission to access the requested resource.
Fix: Check with your administrator to confirm that your account has the correct permissions. -
404 Not found
The requested resource or endpoint does not exist. This often happens when using an incorrect URL.
Fix: Verify that you are calling the correct endpoint and check for typos in the URL. -
405 Method not allowed
The HTTP method used (e.g.,GET
,POST
) is not supported for the endpoint you are calling.
Fix: Review the API reference to confirm the correct HTTP method for the request. -
500 Internal server error
Something went wrong on the API server, which may not be related to your request.
Fix: Retry after a few moments. If the issue persists, it might be a temporary server problem. -
503 Service unavailable
The API service is temporarily down, usually for maintenance or high traffic.
Fix: Wait a few minutes and retry your request. If the issue continues, check the system status page.
How to troubleshoot API errors
If your API request fails, then follow these steps to diagnose and fix the issue:
-
Check authentication
- Confirm that you have included a valid Bearer token in the
Authorization
header. - If the token has expired, then request a new one following the Authentication guide.
- Confirm that you have included a valid Bearer token in the
-
Validate request data
- Make sure all required parameters are included and formatted correctly.
- If you’re unsure about the expected structure, then refer to the API reference.
-
Confirm you are calling the correct endpoint
- Double-check the endpoint URL to make sure it’s correct.
- Ensure that you’re using the right HTTP method (
GET
,POST
, etc.).
-
Check the API response for more details
- If the API returns an error message, read it carefully. It often tells you exactly what went wrong.
- Fix any validation errors and retry the request.
-
Check for service disruptions
- If you receive a
500
or503
error, the API service might be experiencing issues. - Check the system status page for maintenance notifications.
- If you receive a
-
Contact support if needed
- If you have checked everything and the issue persists, reach out to Support.
- When contacting support, include details such as the request method, endpoint, request body, and full response to help diagnose the problem faster.
When an API request fails, the response body often contains more details about what went wrong. For example, a 400 Bad Request
error might return the following response:
In this case, the error message tells you that the request is missing the instanceId
parameter. To fix this, update the request body to include the required parameter.