Hi. 

I am using Google Ads using PHP REST API call. 

*Problem*
I wish to retrieve the campaign and its metrics of Google Ads using PHP 
REST API call. 
I am following the steps explained below. 
I furnish the code below. 
I have copied the error below. 

Please help me to resolve the issue. 

*Steps*
1. I am working for my client. He has created a Test account for me. 
2. I am using a separate gmail account to sign in into this test account. 
3. After login I found the text "Test Account" on top right corner, in 
white color with red background. 
4. It has an account id in this format xxx-xxx-xxxx. I am using this 
account id as the CUSTOMER ID in the URL of REST API call. I am using it 
after removing the dash "-" from it. 
5. I have created a new user with a new personal Gmail id from Tools & 
Settings > Setup > Account access. I have received the email and authorize 
it. 

*Questions*
1. Please let me know whether the above steps are correctly followed. 
Please advice if I missed something. 

*Code*
$url = 
"https://googleads.googleapis.com/v3/customers/xxxxxxxxxx/campaignBudgets:mutate";;
$params = [
    "query" => "SELECT campaign.name, campaign.status, segments.device, 
                metrics.impressions, metrics.clicks, metrics.ctr, 
                metrics.average_cpc, metrics.cost_micros 
                FROM campaign 
                WHERE segments.date DURING LAST_30_DAYS", 
    "token-type" => "Bearar",
    "Authorization" => session()->get('access_token_googleads'),
    "developer_token" => "xxxxx",
    "response_type" => "code", 
    "access_type" => "offline", 
    "client_id" => "xxxxx", 
    "callback_url" => "http://localhost:8000/googleads/profile";, 
    "scope" => "https://www.googleapis.com/auth/adwords";, 
    "refresh_token" => "xxxxx",  
];
$response = $this->curl($url, http_build_query($params), 
"application/json", false, false);
echo "<pre>";
print_r($response);

*Error*

{
  "error": {
    "code": 401,
    "message": "Request is missing required authentication credential. Expected 
OAuth 2 access token, login cookie or other valid authentication credential. 
See https://developers.google.com/identity/sign-in/web/devconsole-project.";,
    "status": "UNAUTHENTICATED"
  }
}


I am waiting for earliest reply. 



Regards & Thanks,

Amit 


-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/53128f26-3367-464c-b5da-ceca1c102dd0%40googlegroups.com.

Reply via email to