Hello Google Ads API Support, I need support for resolved this below issue.
Customer IDs: customers/8165191974 API Error: The caller does not have permission Customer IDs: customers/7114018995 API Error: The caller does not have permission Customer IDs: customers/9172587698 API Error: The caller does not have permission Customer IDs: customers/9232339892 API Error: The caller does not have permission *What is my task:* 1. Get user or audience list 2. Add/Remove the Email or Phone in the exiting list *Below is the my PHP code or you can check the attached PHP code of file* $customer_id = str_replace('customers/', '', $customerResourceName); $api_version = 'v15'; // Google Ads API endpoint URL for searching $api_url = "https://googleads.googleapis.com/{$api_version}/googleAds:search "; // Construct the query to search for audiences $query = 'SELECT audience.id, audience.name FROM audience WHERE campaign.id = ' . $customer_id; // Set up cURL options $curl_options = [ CURLOPT_URL => $api_url, CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => [ 'Authorization: Bearer ' . $new_access_token, 'Content-Type: application/json', 'developer-token: ' . $developer_token, 'login-customer-id: ' . $customer_id, ], CURLOPT_POST => true, CURLOPT_POSTFIELDS => json_encode(['query' => $query]), ]; // Initialize cURL session $ch = curl_init(); curl_setopt_array($ch, $curl_options); // Execute the cURL request and get the response $response = curl_exec($ch); // Check for errors if (curl_errno($ch)) { echo 'cURL Error: ' . curl_error($ch); } else { // Decode and print the response $decoded_response = json_decode($response, true); // Check if the response contains an error if (isset($decoded_response['error'])) { echo 'API Error: ' . $decoded_response['error']['message']; } else { // Print the audience list if available if (isset($decoded_response['results'])) { foreach ($decoded_response['results'] as $result) { echo 'Audience ID: ' . $result['audience']['id'] . PHP_EOL; echo 'Audience Name: ' . $result['audience']['name'] . PHP_EOL; $audience_id = $result['audience']['id']; // Example list of user information (hashed email or phone number) $users = [ ['email' => hash('sha256', 's...@gmail.com.com')], ['email' => hash('sha256', 's...@gmail.com.com')], // Add more users as needed ]; // Google Ads API endpoint URL for adding members to an audience $api_url = " https://googleads.googleapis.com/{$api_version}/customers/$customer_id/userLists/$audience_id:mutateMembers "; // Set up cURL options $curl_options = [ CURLOPT_URL => $api_url, CURLOPT_RETURNTRANSFER => true, CURLOPT_CUSTOMREQUEST => 'POST', CURLOPT_POSTFIELDS => json_encode(['membersList' => $users]), CURLOPT_HTTPHEADER => [ 'Authorization: Bearer ' . $api_key, 'Content-Type: application/json', ], ]; // Initialize cURL session $ch = curl_init(); curl_setopt_array($ch, $curl_options); // Execute the cURL request and get the response $response = curl_exec($ch); // Check for errors if (curl_errno($ch)) { echo 'cURL Error: ' . curl_error($ch); } else { // Decode and print the response $decoded_response = json_decode($response, true); print_r($decoded_response); } // Close cURL session curl_close($ch); } } else { echo 'No audiences found for the specified customer.'; } } } // Close cURL session curl_close($ch); Thanks & Regards Surendra Yadav 9958263028 -- -- =~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~ 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 "Google Ads API and AdWords 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/6e35fcf4-f5e0-4360-8f24-ccf729c2c9fbn%40googlegroups.com.
<<attachment: google-support.php>>