I have contacted Google API for request to pull the data from adwords account .
They suggested use below format of PHP code to call from Rest API.
#!/bin/bash
ENDPOINT='https://googleads.googleapis.com'
VERSION='v3'
CID=6602583583
QUERY='
SELECT
campaign.advertising_channel_type,
metrics.all_conversions,
metrics.cost_per_conversion,
metrics.impressions,
metrics.interactions
FROM campaign
'
curl -v --header "Authorization: Bearer $ACCESS_TOKEN" --header "developer-token: $DEV_TOKEN" --data query="$QUERY" $PROD_ENDPOINT/$VERSION/customers/$CID/googleAds:search.
I tried below format of Rest resource to call the google adwords API .I am not sure whether i am sending right request same as above like PHP.
When I run below code I am getting error "status not found".
Http http = new Http();
HttpRequest httpReq = new HttpRequest();
HttpResponse httpRes = new HttpResponse();
String Query='SELECT campaign.advertising_channel_type, metrics.all_conversions, metrics.cost_per_conversion,metrics.impressions, metrics.interactions FROM campaign';
httpReq.setEndpoint('https://googleads.googleapis.com/v3/customers/6602583583/googleAds:search');
httpReq.setMethod('POST');
httpReq.setHeader('developer-token', 'developertoken');
httpReq.setHeader('Authorization','Bearer+Access token');
httpReq.setHeader('login-customer-id', 'customerid');
httpReq.setHeader('Accept', 'application/json');
httpReq.setHeader('Content-Type', 'application/json');
httpReq.setHeader('Host', 'googleads.googleapis.com');
httpReq.setHeader('Content-Length', '784');
httpReq.setBody('Query');
httpRes = (new Http()).send(httpReq);
if(httpRes.getStatusCode() == 200){
string response1= httpRes.getBody();
System.debug('#### HtteRes '+HttpRes.getBody());
Map<String, Object> responseMap = (Map<String, Object>)JSON.deserializeUntyped(response1);
system.debug('response map values to verify'+ responseMap);
}