SearchStream not able to reuse

26 views
Skip to first unread message

cv

unread,
Mar 30, 2022, 6:43:34 AM3/30/22
to Google Ads API and AdWords API Forum
Hi,

I tried to use search stream like this.
Call 1:
foreach ($stream->readAll() as $response) {
foreach ($response->getResults() as $i=> $googleAdsRow) {
}
}
call2:
foreach ($stream->readAll() as $response) {
if ($response->hasSummaryRow()) {
}
}

Once I readAll data in call1, under call2 the stream will not get data.

Any idea why?
Does stream only readable once?


Thanks



Google Ads API Forum Advisor

unread,
Mar 31, 2022, 1:26:09 AM3/31/22
to chirag....@gmail.com, adwor...@googlegroups.com

Hi,
 

Thanks for reaching out to the Google Ads API Support team.
 

With regards to your concern. I would refer you to this documentation Search & SearchStream Both methods support the same queries and return equivalent results.
 

  • The search method returns data in customizable page sizes, enabling you to iterate over a result set using pagination.
  • The SearchStream method, on the other hand, streams the entire result set back in a single response, which can be more efficient for bulk data retrieval.


However, so that our team can better check on this, could you please provide the complete API logs (request and response with request-id)?
 

You can provide it via Reply privately to author option. If this option is not available, then send it instead on this email address googleadsa...@google.com.
 

Regards,

Google Logo
Darwin
Google Ads API Team
 


ref:_00D1U1174p._5004Q2ZI1Xy:ref

cv

unread,
Mar 31, 2022, 2:50:56 AM3/31/22
to Google Ads API and AdWords API Forum
Hello Darwin,

Thanks for the message. I might have not clarified things properly. There is no issue with calling or response. I have usage question. 

My problem is once you read the stream it will not give data again without calling query again.
$googleAdsServiceClient->searchStream($customerId, $query, $options)

My problem is I need summery row and result set both in different tables. So I am calling searchStream and get the stream response
what I am doing is read the stream first and store the summary row.

when I tried to call same stream again without searchStream call it simply not give result.
So any way I can preserve that stream?

Google Ads API Forum Advisor

unread,
Mar 31, 2022, 10:54:47 AM3/31/22
to chirag....@gmail.com, adwor...@googlegroups.com
Hi, 

I work with Darwin. For issues specific to the Google Ads API PHP Client Library you may reach out to the Google Ads API PHP Client Library issue tracker. With that being said, you may want to try out this solution.

Regards,

Google Logo
Aryeh
Google Ads API Team
 


ref:_00D1U1174p._5004Q2ZI1Xy:ref

cv

unread,
Apr 1, 2022, 12:46:42 AM4/1/22
to Google Ads API and AdWords API Forum
Hi Aryeh,

I already contacted them and solution you suggested that I am aware and I already tried same before contacting here.
See this thread at Google Ads API PHP Client Library. It was limitation by Google Ads API.

Thanks,

Google Ads API Forum Advisor

unread,
Apr 1, 2022, 3:14:48 AM4/1/22
to chirag....@gmail.com, adwor...@googlegroups.com

Hi there,

Thanks for updating us on the issue. We’re happy to know that your concern has been addressed by PHP client library thread. Feel free to send us additional queries that you may have, and our team will assist you better.

Regards,

Google Logo
Yasar
Google Ads API Team
 


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