I am calling my test acount using rest api and getting error. Status not found .

28 views
Skip to first unread message

Siva Ragula

unread,
Jan 29, 2020, 5:36:02 AM1/29/20
to AdWords API and Google Ads API Forum
 HttpRequest httpReq = new HttpRequest();
        HttpResponse httpRes = new HttpResponse();
        String errorMessage = '';
        if(googleCred != null && googleCred.size() > 0 && code != null){
            httpReq.setMethod('POST');
            httpReq.setEndpoint('https://oauth2.googleapis.com/token');
           // System.debug('Endpoint chck'+setEndpoint);
            httpReq.setHeader('Host', 'www.googleapis.com');
            httpReq.setHeader('Content-Type', 'application/x-www-form-urlencoded');
            httpReq.setTimeout(12000);
            String requestBody = 'code='+code+'&client_id='+googleCred[0].Client_ID__c+'&client_secret='+googleCred[0].Client_Secret__c;
            requestBody+= '&redirect_uri='+googleCred[0].Redirect_URI__c+'&grant_type='+googleCred[0].grant_type__c;
            

error

11:31:22.0 (10858526)|CALLOUT_REQUEST|[66]|System.HttpRequest[Endpoint=https://oauth2.googleapis.com/token, Method=POST]
11:31:22.0 (157818650)|HEAP_ALLOCATE|[EXTERNAL]|Bytes:566
11:31:22.0 (159242113)|CALLOUT_RESPONSE|[66]|System.HttpResponse[Status=Not Found, StatusCode=404]
11:31:22.0 (159275031)|HEAP_ALLOCATE|[66]|Bytes:22
11:31:22.0 (159444878)|VARIABLE_ASSIGNMENT|[66]|httpRes|"System.HttpResponse[Status=Not Found, StatusCode=404]"|0x464c47d1

Siva Ragula

unread,
Jan 30, 2020, 6:10:28 AM1/30/20
to AdWords API and Google Ads API Forum


I have identified the issue is due to header  and it has been solved now.

How to extract the campaign-clicks information through adwords API.




Google Ads API Forum Advisor Prod

unread,
Jan 30, 2020, 12:48:48 PM1/30/20
to sra...@aximpro.com, adwor...@googlegroups.com

Hello Siva,

Thank you for reaching out. You could use Campaign Performance Report to retrieve the clicks at the campaign level via Adwords API. Please refer to this code sample to download the report via AdWords API using AWQL. Let us know if you need any additional information.

Regards,
Nikisha Patel, Google Ads API Team



ref:_00D1U1174p._5001USx47K:ref
Reply all
Reply to author
Forward
0 new messages