Exception says "An API exception has occurred. See ApiException and InnerException fields for more details."

121 views
Skip to first unread message

Oscar Martinez

unread,
Aug 21, 2014, 2:59:29 PM8/21/14
to adwor...@googlegroups.com
Hi, 

I get this error trying to get information about campaigns. I'm using one of the examples of the official .Net Library.
Looking for a similar post, I found this: 

Answering what Takeshi Hagikura asked in the post reply:

Are you using a test account or a production account? 
Both, Production and Testing account.

Either way, please make sure you have accepted the terms&conditions for AdWords API.
Yes, I have.

If you use a production account, please make sure you have filled in the billing information.
Yes, I have. Production MCC Developer Token is pending approval.

Error message:
Failed to get campaigns. Exception says "An API exception has occurred. See ApiException and InnerException fields for more details."

What I get from OAuth2:
<add key='AuthorizationMethod' value='OAuth2' />
<add key='OAuth2ClientId' value='XXXXXXXXXXXXXXX' />
<add key='OAuth2ClientSecret' value='XXXXXXXXXX' />
<add key='OAuth2RefreshToken' value='XXXXXXXXXXX' />

Thank you, 

Oscar Martinez

unread,
Aug 21, 2014, 4:36:07 PM8/21/14
to adwor...@googlegroups.com
More info... 

Debugging we find this error message:
[AuthorizationError.USER_PERMISSION_DENIED @ ; trigger:'<null>']

We find it in:
    protected virtual object[] MakeApiCall(string methodName, object[] parameters) {
      ErrorHandler errorHandler = CreateErrorHandler();

      while (true) {
        try {
          InitForCall(methodName, parameters);
          return base.Invoke(methodName, parameters);  //-> Here is the error
     ....

Thanks, 

Ray Tsang (AdWords API Team)

unread,
Aug 21, 2014, 6:21:59 PM8/21/14
to adwor...@googlegroups.com
Oscar,

Most likely the user you used to login/authorize the OAuth 2.0 token does not have the permission to access the account.  Please double check and regenerate the token.

Thanks,

Ray

Oscar Martinez

unread,
Aug 22, 2014, 11:45:14 AM8/22/14
to adwor...@googlegroups.com
Hi Ray, 

Thanks for your answer. Are you talking about regenerating the token in MCC? And, what account, Testing or my company's Production?


On Thursday, August 21, 2014 12:59:29 PM UTC-6, Oscar Martinez wrote:

Anash P. Oommen (AdWords API Team)

unread,
Aug 22, 2014, 12:36:41 PM8/22/14
to adwor...@googlegroups.com
Hi Oscar,

No, AdWords API requires an OAuth2 access and refresh token to make calls to the account. If your current credentials cannot make calls to the desired account, you have to use one that has access to perform the required operation.

See the instructions on https://github.com/googleads/googleads-dotnet-lib/wiki/Using-OAuth2TokenGenerator to generate a new set of refresh and access tokens using a login email that has the right set of permissions.

Cheers,
Anash P. Oommen,
AdWords API Advisor.

Oscar Martinez

unread,
Aug 22, 2014, 12:44:23 PM8/22/14
to adwor...@googlegroups.com
Hi Anash, 

Yes, we followed that process to get the XML lines for web.config. I will the redo the process and let you know what we get.

Thank you, 


On Thursday, August 21, 2014 12:59:29 PM UTC-6, Oscar Martinez wrote:

Oscar Martinez

unread,
Aug 22, 2014, 2:03:35 PM8/22/14
to adwor...@googlegroups.com
We do it again... the result was the same error. We tried with Testing Account and Production Account.

Pdata: is it possible to know for this media why our Production Token continues being as "Pending Approval"?

Thank you, 

On Thursday, August 21, 2014 12:59:29 PM UTC-6, Oscar Martinez wrote:

Anash P. Oommen (AdWords API Team)

unread,
Aug 22, 2014, 3:10:41 PM8/22/14
to adwor...@googlegroups.com
Hi Oscar,

Could you respond privately by using the "Reply to Author" option and provide the following details?

1. A request and response SOAP log for failed request.
2. The login email that you used to generate your refresh token?

I'll take a look and help figure out what may be wrong.

Cheers,
Anash P. Oommen,
AdWords API Advisor.

Oscar Martinez

unread,
Aug 25, 2014, 10:23:23 AM8/25/14
to adwor...@googlegroups.com
Hi Anash, 

Last Friday I sent you the information about the SOAP log. I both cases, Test and Production accounts, we get the same SOAP log message.

Thank you. 


On Thursday, August 21, 2014 12:59:29 PM UTC-6, Oscar Martinez wrote:

Anash P. Oommen (AdWords API Team)

unread,
Aug 25, 2014, 11:11:51 AM8/25/14
to adwor...@googlegroups.com
Hi Oscar,

I sent you a private response, could you reply to that email and provide the logs once more?

Thx,
Anash

Oscar Martinez

unread,
Aug 25, 2014, 11:43:10 AM8/25/14
to adwor...@googlegroups.com
Done! I sent it by email.


On Thursday, August 21, 2014 12:59:29 PM UTC-6, Oscar Martinez wrote:
Reply all
Reply to author
Forward
0 new messages