googleAdsService := services.NewGoogleAdsServiceClient(client.Conn())
// Create a search request
request := services.SearchGoogleAdsRequest{
CustomerId: "1234567890", // here just faked
Query: "SELECT campaign.id, campaign.name FROM campaign",
}
// Get the results
response, err := googleAdsService.Search(client.Context(), &request)
if err != nil {
fmt.Printf("err:%v\n", err)
} else {
for _, row := range response.Results {
campaign := row.Campaign
fmt.Printf("id: %d, name: %s\n", campaign.Id.Value, campaign.Name.Value)
}
}
I always received the response:
err:rpc error: code = Internal desc = Internal error encountered.
When the credentiuals is wrong, the response instead of above will be:
panic: oauth2: cannot fetch token: 400 Bad Request
Response: {
"error": "invalid_grant",
"error_description": "Bad Request"
}
So I'm sure the credentials is correct, which I am using to fetch data through AWQL.
Thanks for your help.
Tao Hello,
Thank you for writing to us regarding your concern. The error "Internal Error Encountered" could be transient and retrying the request generally resolves the issue. Also, we do not have client libraries for Go language. If you are facing any issues related to that library, you could file an issue on the Github issue tracker. The Google Ads API Beta has the client libraries and examples available in the programming languages specified here. Additionally, you could make API calls to the Google Ads API beta via the CURL requests mentioned here. Let me know if you have any further API related concerns.
Regards,
Nikisha Patel, Google Ads API Team