Adding an Image Asset for creating Ad

71 views
Skip to first unread message

Anushri shanbhag

unread,
May 27, 2019, 12:56:37 AM5/27/19
to AdWords API and Google Ads API Forum
I need to create an ad and I need to upload an image asset so I can use it with Ad. 

 
ad_imageasset_service  = client.get_service('AssetService', version='v1')
ad_imageadd_operation  = client.get_type('AssetOperation', version='v1')
ad_imageadd            = ad_imageadd_operation.create 

I am now trying to add the image.  I have the image and it's details. But I see that we need to input the image data in bytes . 

Could you please validate if above is right ? Also considering we have the image, how should we input the image data in bytes ? 


Thanks and Regards,
Anushri

revarasi Sofa

unread,
May 27, 2019, 1:00:08 AM5/27/19
to anushr...@gmail.com, AdWords API and Google Ads API Forum
service korsi sopa bandung

--
--
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
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 adwor...@googlegroups.com
To unsubscribe from this group, send email to
adwords-api...@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...@googlegroups.com.
Visit this group at https://groups.google.com/group/adwords-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/adwords-api/064c8ef0-f993-43a6-9e45-0b5b5d316399%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

revarasi Sofa

unread,
May 27, 2019, 1:00:55 AM5/27/19
to anushr...@gmail.com, AdWords API and Google Ads API Forum
service korsi sopa dibandug

Google Ads API Forum Advisor Prod

unread,
May 28, 2019, 12:23:13 PM5/28/19
to service....@gmail.com, anushr...@gmail.com, adwor...@googlegroups.com

Hi Anushri,

Here's an example from the Python client library where we add an image using the MediaFileService. The same operation via AssetService should be quite similar, a rough example is below:

asset_operation = client.get_type('AssetOperation', version='v1')
asset = asset_operation.create
asset.image_asset.data.value = image_bytes


Here image_bytes is the raw image data. In the example I linked we retrieve it by requesting the data from a URL here, but you could also read that data from a file.

Hope that helps!

Best,
Ben Karl, Google Ads API Team



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