Get ImageAd MediaFile or Data with GoogleAdsService.Search

482 views
Skip to first unread message

Zhong Li

unread,
Jan 25, 2022, 7:54:51 PM1/25/22
to Google Ads API and AdWords API Forum
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).

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!

                  Google Ads API Forum Advisor

                  unread,
                  Jan 26, 2022, 3:05:48 AM1/26/22
                  to zli.ac...@gmail.com, adwor...@googlegroups.com
                  Hi Zhong,

                  Thank you for providing more details to your concern.

                  To further check the concern, could you provide the complete request and response logs with request ID and request header generated on your end for using AdGroupAdService?

                  If the logs are not available, and if you haven't yet, logging can be enabled by navigating to the Client libraries > Your client library (ex. Java) > Logging documentation, which you can access from this link. You may then try replicate the scenario and provide to our team the complete logs of your API requests.

                  Regards,
                  Google Logo
                  Teejay Wennie Pimentel
                  Google Ads API Team
                   


                  ref:_00D1U1174p._5004Q2VPa1u:ref

                  Javier Val Lista

                  unread,
                  Mar 10, 2022, 9:22:31 AM3/10/22
                  to Google Ads API and AdWords API Forum
                  Hello everyone,

                  I have exactly the same problem as you. I am using GoogleAdsService.Search to retrieve the information about ImageAd and its associated MediaFile. To achieve this, I would need to get the MediaFile ResourceName, but that´s a field that is not available to SELECT clauses.

                  Here is an example of my query:

                  SELECT
                                      ad_group.id,
                                          campaign.id,
                                          ad_group_ad.policy_summary.policy_topic_entries,
                                          ad_group_ad.policy_summary.review_status,
                                          ad_group_ad.policy_summary.approval_status,
                                          ad_group_ad.status,
                                          ad_group_ad.ad.id,
                                          ad_group_ad.ad.final_urls,
                                          ad_group_ad.ad.name,
                                          ad_group_ad.ad.image_ad.image_url,
                                          ad_group_ad.ad.image_ad.name,
                                          ad_group_ad.ad.image_ad.media_file -> The following field may not be used in SELECT clause, but I need it!!! :_(
                                      FROM ad_group_ad


                  Have you found any solution?

                  Thank you very much! Greetings from Spain

                  Google Ads API Forum Advisor

                  unread,
                  Mar 10, 2022, 10:03:09 PM3/10/22
                  to javil...@gmail.com, adwor...@googlegroups.com
                  Hi Javier,

                  Thank you for reaching out to Google Ads API team.

                  With regard to your concern, the ad_group_ad.ad.image_ad.media_file is not selectable to the ad_group_ad and I am afraid that there is no workaround to include this to the said report type. However, I can raise a feature request to my team so that it will become selectable on the ad_group_ad, subject for review. Also, can I ask about your use case first on why you need to retrieve this information in the ad_group_ad report?

                  Regards,
                  Google Logo
                  Carmela
                  Google Ads API Team
                   


                  ref:_00D1U1174p._5004Q2XnGqL:ref

                  Colin Lee

                  unread,
                  Apr 12, 2022, 12:17:28 PM4/12/22
                  to Google Ads API and AdWords API Forum
                  Hi Carmela,

                  I need the name of the file for the image.  It doesn't come through in the name field and the media_file property is returning an error.

                  Can you please update the documentation to say that this field doesn't work if you can't get the team get the property to work?

                  Cheers,
                  Colin

                  megan

                  unread,
                  May 6, 2022, 9:44:57 AM5/6/22
                  to Google Ads API and AdWords API Forum

                  Hey Google team, 

                  Following up on Colin's above email. We are attempting to pull in the name of the media file when the Ad Type is an image or video such as "IMAGE_AD." media_file property is returning an error,  even though it is stated as available in the documentation. 

                  Can you please guide us on how to pull this in if it is available?

                  Google Ads API Forum Advisor

                  unread,
                  May 9, 2022, 11:31:48 PM5/9/22
                  to adwor...@googlegroups.com

                  Hi All,
                   

                  Thanks for your response. I am also a member of the Google Ads API team and let me provide support to your concern.
                   

                  Moving forward to your concern, "Can you please update the documentation to say that this field doesn't work if you can't get the team get the property to work?" With this suggestion, I am afraid that our team would not be able to update the documentation. However, you can refer to this selectable section field ad_group_ad.ad.image_ad.media_file as indicated here if the field in the specific report type is selectable or not.
                   

                  Regards,

                  Google Logo
                  Darwin
                  Google Ads API Team
                   


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