Hello,

It is most likely the error message is correct -- you use an invalid access 
token. Please make sure this is the access (not refresh) token which is 
still valid, generated for correct (AdWords) account and requested for 
AdWords scope.

Also, please avoid posting tokens on the forum as they are visible to 
everyone. It is important you reset the developer token posted here so it 
can not be used by 3rd party. It can be reset on the AdWords API Center 
(review status will not change).


-Danial, AdWords API Team.


On Wednesday, December 4, 2013 4:45:49 PM UTC+4, noam....@conduit.com wrote:
>
> I'm trying to access adwords API with the following code in salesforce:
>
> HttpResponse res = new HttpResponse();
> Http http = new Http();
>  req.setEndpoint('
> https://adwords.google.com/api/adwords/reportdownload/v201309');
> req.setMethod('POST');
> req.setHeader('Authorization', 'Bearer 
> ya29.1.AADtN_XN5J-ld2VbjCwzwMdWgCf62FoJ5dhdw5LIDLO3hA_P6PkhE43w4jLDzKsg');
>         req.setHeader('developerToken', 'Ox80jWNwZ9jZa5175T-Q3A');
>         req.setHeader('clientCustomerId', '203-167-7812');
>         req.setHeader('returnMoneyInMicros', 'false');
>         req.setHeader('Content-type', 'application/x-www-form-urlencoded'); 
>         
>         
>         String body = '<reportDefinition xmlns="
> https://adwords.google.com/api/adwords/cm/v201309";>\n' + 
>         '<selector>\n' +
>     '<fields>CampaignId</fields>\n' +
>     '<fields>Id</fields>\n' +
>     '<fields>Impressions</fields>\n' +
>     '<fields>Clicks</fields>\n' +
>     '<fields>Cost</fields>\n' +
>         '<predicates>\n' + 
>       '<field>Status</field>\n' +
>       '<operator>IN</operator>\n' +
>       '<values>ENABLED</values>\n' +
>       '<values>PAUSED</values>\n' +
>     '</predicates>\n' +
>   '</selector>\n' +
>   '<reportName>test</reportName>\n' +
>   '<reportType>ADGROUP_PERFORMANCE_REPORT</reportType>\n' +
>   '<dateRangeType>LAST_7_DAYS</dateRangeType>\n' + 
>   '<downloadFormat>CSV</downloadFormat>\n' + 
> '</reportDefinition>\n';
>         req.setBody('__rdxml=' + EncodingUtil.urlEncode(body, 'UTF-8'));  
>         system.debug('AM --> body ' + req.getBody());
>
>         try {
>         res = http.send(req);         
>         System.debug(res.getBody());         
>     } catch(System.CalloutException e) {
>         System.debug('Callout error: '+ e);
>         System.debug(res.toString());
>     } 
>
>
> And I'm getting the following error:
> <?xml version="1.0" encoding="UTF-8" 
> standalone="yes"?><reportDownloadError><ApiError><type>AuthenticationError.OAUTH_TOKEN_INVALID</type><trigger>&lt;null&gt;</trigger><fieldPath></fieldPath></ApiError></reportDownloadError>
>
> The token is valid and new
>
> Please advise 
> Thanks
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog and discussion group:
http://googleadsdeveloper.blogspot.com
http://groups.google.com/group/adwords-api
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to