Search stream request

152 views
Skip to first unread message

Shelly Saju

unread,
Aug 16, 2022, 12:08:06 PM8/16/22
to Google Ads API and AdWords API Forum
Hi GoogleAds team,

I was trying to fetch the campaign name.
Please help me to resolve this. Below is my code:


$query =
"SELECT
campaign.status
FROM campaign
ORDER BY campaign.id";

// Issues a search stream request.
/** @var GoogleAdsServerStreamDecorator $stream */
$stream = $googleAdsServiceClient->searchStream($customerId, $query);

print_r($stream->iterateAllElements());

it outputs:
Generator Object ( )

I have checked Google Ads and there we are running the Campaigns.

Thanks
Shelly
Message has been deleted

Luiz Eduardo Da Cruz

unread,
Aug 16, 2022, 12:32:47 PM8/16/22
to Google Ads API and AdWords API Forum
Hi!

Here we use the following format to get the values using Python:


ga_service = client.get_service("GoogleAdsService", version="v7")

query = """
SELECT
campaign.bidding_strategy_type,
campaign.target_roas.target_roas,
campaign.maximize_conversion_value.target_roas,
campaign.target_cpa.target_cpa_micros
FROM campaign
ORDER BY campaign.id"""


response = ga_service.search_stream(customer_id=customer_id, query=query)

for batch in response:
        for row in batch.results:
               print(row.campaign) 
               print(row.campaign_id)

this way you can get the campaign values.

Google Ads API Forum Advisor

unread,
Aug 16, 2022, 1:41:08 PM8/16/22
to shelly...@gmail.com, adwor...@googlegroups.com
Hi Shelly,

Thank you for reaching out to us.

For our team to further investigate this, could you provide the complete API logs (request and response with request-id) generated on your end and also the full screenshot of the Google Ads UI with the campaign name you want to retrieve?

You may then send the requested logs via the Reply privately to author option. If this option is not available, you may send the details directly to our googleadsa...@google.com alias instead.

Best regards,
Google Logo
Heidi
Google Ads API Team
 


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