RE: Trying to access to adword API with salesforce
Hi Siva, Thank you for writing to us regarding your concern. Since you are trying to access AdWords API from Salesforce, I would recommend reaching out to the Salesforce team via this forum as they are better equipped to assist you with your concern. We do not have any related blogs or posts that could assist you with your concerns as this is outside our expertise. Please feel free to reach out for any AdWords API related concerns. Regards, Nikisha Patel, Google Ads API Team ref:_00D1U1174p._5001USwcEU:ref -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog: https://googleadsdeveloper.blogspot.com/ =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API and Google Ads 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 and Google Ads API Forum" group. To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/Q_OCe0Q47V4W00orKefAEuQLWAq2w22bGBdw%40sfdc.net.
Re: Trying to access to adword API with salesforce
I have a similar requirement . Can you please help me provide the steps or any blogs if you have published/referred for the same. Regards, Siva Ragula On Wednesday, December 4, 2013 at 1:45:49 PM UTC+1, 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 = 'https://adwords.google.com/api/adwords/cm/v201309;>\n' + > '\n' + > 'CampaignId\n' + > 'Id\n' + > 'Impressions\n' + > 'Clicks\n' + > 'Cost\n' + > '\n' + > 'Status\n' + > 'IN\n' + > 'ENABLED\n' + > 'PAUSED\n' + > '\n' + > '\n' + > 'test\n' + > 'ADGROUP_PERFORMANCE_REPORT\n' + > 'LAST_7_DAYS\n' + > 'CSV\n' + > '\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: > standalone="yes"?>AuthenticationError.OAUTH_TOKEN_INVALIDnull > > The token is valid and new > > Please advise > Thanks > -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ Also find us on our blog: https://googleadsdeveloper.blogspot.com/ =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ You received this message because you are subscribed to the Google Groups "AdWords API and Google Ads 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 and Google Ads API Forum" group. To unsubscribe from this group and stop receiving emails from it, send an email to adwords-api+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/c273db80-7a4a-41cf-8518-4df58e2738c9%40googlegroups.com.
Re: Trying to access to adword API with salesforce
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' + 'fieldsCampaignId/fields\n' + 'fieldsId/fields\n' + 'fieldsImpressions/fields\n' + 'fieldsClicks/fields\n' + 'fieldsCost/fields\n' + 'predicates\n' + 'fieldStatus/field\n' + 'operatorIN/operator\n' + 'valuesENABLED/values\n' + 'valuesPAUSED/values\n' + '/predicates\n' + '/selector\n' + 'reportNametest/reportName\n' + 'reportTypeADGROUP_PERFORMANCE_REPORT/reportType\n' + 'dateRangeTypeLAST_7_DAYS/dateRangeType\n' + 'downloadFormatCSV/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?reportDownloadErrorApiErrortypeAuthenticationError.OAUTH_TOKEN_INVALID/typetriggerlt;nullgt;/triggerfieldPath/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.
Trying to access to adword API with salesforce
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' + 'fieldsCampaignId/fields\n' + 'fieldsId/fields\n' + 'fieldsImpressions/fields\n' + 'fieldsClicks/fields\n' + 'fieldsCost/fields\n' + 'predicates\n' + 'fieldStatus/field\n' + 'operatorIN/operator\n' + 'valuesENABLED/values\n' + 'valuesPAUSED/values\n' + '/predicates\n' + '/selector\n' + 'reportNametest/reportName\n' + 'reportTypeADGROUP_PERFORMANCE_REPORT/reportType\n' + 'dateRangeTypeLAST_7_DAYS/dateRangeType\n' + 'downloadFormatCSV/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?reportDownloadErrorApiErrortypeAuthenticationError.OAUTH_TOKEN_INVALID/typetriggerlt;nullgt;/triggerfieldPath/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.