Get ImageAd MediaFile or Data with GoogleAdsService.Search

2022-01-25 Thread Zhong Li
Hi,

I am currently working on migrating our AdWords API client to GoogleAds API 
client, and I am having an issue to list all ImageAds with the 
GoogleAdsService.Search (Google Ads SearchQuery).

In the old AdWords API, the AdGroupAdService.Get() will return an ImageAd 
with Image entity 
(https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupAdService.ImageAd)
 
(https://developers.google.com/adwords/api/docs/reference/v201809/AdGroupAdService.Image)
 
The Image entity contains all media file info,


With AdGroupAdService.Get(), I can get an AdGroupAd with ImageAdInfo, 
(https://developers.google.com/google-ads/api/reference/rpc/v9/ImageAdInfo?hl=en)
 
and it would contains either a "media_file" filed (media file resourceName) 
or "data" field (Raw image data as bytes).

But when I try to list ImageAds with the GoogleAdsService.Search (Google 
Ads SearchQuery). I can only find those ImageAd fields available for query:

   - ad_group_ad.ad.image_ad.image_url
   - ad_group_ad.ad.image_ad.mime_type
   - ad_group_ad.ad.image_ad.name
   - ad_group_ad.ad.image_ad.pixel_height
   - ad_group_ad.ad.image_ad.pixel_width
   - ad_group_ad.ad.image_ad.preview_image_url
   - ad_group_ad.ad.image_ad.preview_pixel_height
   - ad_group_ad.ad.image_ad.preview_pixel_width


   

   

   

   

   

   

   

   
I could not get the MediaFile Resource Name of the image or the raw data. 

May I ask is there a way to list ImageAd with the media file info by search 
query? or is there another option to link them?


BTWI found for VideoAd, the search query actually provided a filed called 
"ad_group_ad.ad.video_ad.media_file" and it contains the Video Media file 
resource name. If I can get the MediaFile Resource Name as field 
"ad_group_ad.ad.image_ad.media_file", I might be able to make another query 
from media_file to get the media file detailed info.


Thanks!

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/826c194a-0e8e-4897-a2da-ba7990586557n%40googlegroups.com.


Re: Can GoogleAdService Query Pagination support fetching a specific page?

2022-01-06 Thread Zhong Li
Thanks for replying. I knew the usage of  page_size but it's not convenient 
if we want to get a specific range with variable start index.

Hope Goolgle consider to add the offset support in GAQL, anyways... thanks 
again!

On Friday, January 7, 2022 at 2:28:46 a.m. UTC-5 adsapi wrote:

> Hi,
>
> Thanks for reaching out to us.
>
> Note that LIMIT with offset is not supported in GAQL. An equivalent way to 
> achieve this using pagination. The pagination uses pageSize by specifying 
> page_size 
> 
>  
> in your request. This will break up the result set of the query into 
> multiple responses that each contain up to page_size 
> 
>  
> objects. If page_size 
> 
>  
> is not specified, it is automatically set to the maximum page size of 
> 10,000 rows.
>
> Suppose if your account contains 50,000 keywords and page_size 
> 
>  
> is set to 1,000, the result set will contain 1,000 GoogleAdsRow 
>  
> objects in the first response, along with a next_page_token 
> .
>  
> To retrieve the next one thousand rows, simply send the request again with 
> the same page size, but update the request's page_token to the response's 
> next_page_token 
> .
>  
> The value of page_size 
> 
>  
> in the subsequent requests can be different each time. The next_page_token 
> 
>  
> will not be populated on the response that contains the last batch of 
> rows. For more information on paging, you may refer to this guide 
> . Let 
> us know if you have any further questions.
>
> Regards, 
> [image: Google Logo] 
> Yasar 
> Google Ads API Team 
>   
>
> ref:_00D1U1174p._5004Q2UhT68:ref
>

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/a7b4fc16-c8e1-4f2b-a4ec-25fce611587cn%40googlegroups.com.


Can GoogleAdService Query Pagination support fetching a specific page?

2022-01-06 Thread Zhong Li
In the old AdWords API, the SelectorBuilder can specify offset/limit to 
fetch a specified page of entity 
results(https://ads-developers.googleblog.com/2014/02/adwords-api-java-selector-builder.html).
 

For example, if my campaign has 2000 ads, I want to list the ads from 501 
to 600, then I make the  SelectorBuilder builder = new SelectorBuilder() 
.fields("Id", "Name") .orderAscBy("Id") .offset(500) .limit(100) .build()

But in the GoogleAds API, the  GoogleAdsService.SearchStream would return a 
stream of all results. To get a custom page (with specified offset), we 
need to manually read the stream and handle it on client side; If we use 
GoogleAdsService.Search, then it does not support "offset" but can only 
specify the pageSize, so we still need iterate the pages and calculate the 
"desired page of results".

May I ask if there's a better way to achieve this? or any equivalent 
solution in GoogleAds API as the AdWords API's SelectorBuilder.

Thanks!

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/39cacdad-2044-4d64-be56-6809e4d8082cn%40googlegroups.com.


No valid AdType value return in Create AdGroupAd response

2022-01-05 Thread Zhong Li
When we create Ad through AdGroupAdService (
https://developers.google.com/google-ads/api/reference/rpc/v9/AdGroupAdService),
 
the response with created AdGroupAd contains the empty value in "type" 
field (in the Ad) instead of the correct AdType.

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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/b394dd06-0321-4be2-9319-f948b99f219fn%40googlegroups.com.