There are many scenarios where you may encounter errors when working with the Display & Video 360 API. These could relate to a bug in your code, invalid user input, or even an issue with the API itself. Whatever the reason, knowing how to troubleshoot errors is an important part of the development process. This guide will provide some best practice tips to get you started.
Reviewing the basics
- Review the prequisites guide. Ensure you have access to Display & Video 360 and a properly configured API project.
- If your response contains HTTP errors, make sure you review these carefully and ensure that the request is being made to the correct API and service.
- Review the authorization guide. Ensure your request contains the necessary OAuth 2.0 credentials.
Verify that you're using the correct credentials. See the Set Up Your Application guide for details on generating authentication credentials. You may also pass your access token to the Google OAuth2 API's tokeninfo endpoint to verify that it is issued to the correct API project and authorized for the correct scope(s):
POST https://www.googleapis.com/oauth2/v2/tokeninfo?access_token={YOUR_ACCESS_TOKEN} 200 OK { "issued_to": "{API_PROJECT_CLIENT_ID}", "audience": "...", "scope": "{API_SCOPES}", "expires_in": ... }
Understanding errors
When the API encounters an error, it normally returns a JSON response containing
an error
object. This object provides additional context about the specific
error that was encountered.
{
"error": {
"code": 404,
"message": "Resource type LINE_ITEM does not exist: advertisers/1/lineItems/1",
"status": "NOT_FOUND"
}
}
Usually the contents of the error
object will contain enough information to
help you identify what's gone wrong. If not, you may need to do some additional
research to figure out what the error means.
Researching errors
Refer to the section on common errors, which provides details for some of the most frequently encountered errors.
If the error isn't covered in the common errors section, refer to the reference documentation and try searching for the error code, status, and message.
If you come across any errors that aren't documented, please let us know.
Identifying the root cause
By this point you've identified the error and understand what it means. If not, head back to understanding errors or jump ahead to getting help if you believe you've come across an error in the API that you can't fix yourself.
Before you can fix the error, you'll need to identify what's causing it. Often this will be a bug in your code or an invalid input value.
To determine whether the issue is related to a bug in your code, you should first verify that your code is working as intended. As a first step, consider reviewing the section of code responsible for making the failing request to check for obvious issues. In some cases it may be necessary to use a debugging tool to step through the code line-by-line to ensure it's functioning correctly.
Examining HTTP requests is another useful way to identify potential bugs, as well as cases of invalid input. Many of the official client libraries can be configured to log HTTP requests and responses; review the documentation for your library of choice for more details. An HTTP proxy such as Charles, Squid, or Fiddler can also be used to capture request and response logs. Once you obtain these logs, review them to ensure that the request parameter values being provided by your application are correct and match what you expect.
Once you identify the bug or invalid input responsible for causing the error, the fix will hopefully be obvious. If you're stuck or unsure how best to fix the problem, however, you can use the information you've gathered so far when getting help.
Getting help
If you aren't able to resolve an error yourself, you can contact our support team via this form located in the Display & Video 360 help center.
When filling out this form, you should include as much information as possible about the issue you're facing and the troubleshooting steps you've already taken. Useful information to include:
- HTTP request and response logs. Make sure to redact sensitive information such as OAuth 2.0 access tokens, email addresses, etc.
- Code snippet. If you're able to isolate the issue to a particular section of code or suspect the issue is language-specific, include a small snippet to illustrate what you're doing.
- Additional information, such as runtime/interpreter version and platform, which may be useful for others attempting to reproduce the issue.
Fixing the issue
Once you've identified the cause of the issue and come up with a solution, it's time to implement a fix. Whenever possible, test your fix in a controlled environment (such as a partner or advertiser configured specifically for testing) against a range of both good and bad inputs before deploying to production.