Can I create an Image Ad without pushing the image binary at the same time?

20 views
Skip to first unread message

Adam McKee

unread,
Nov 6, 2017, 4:28:00 PM11/6/17
to AdWords API Forum
Hi folks,

I want to provision a new Image Ad without pushing its image binary over the wire when calling AdGroupAdService.mutate(operations).

Is there a way to replace the highlighted portion below with a reference to a public URL that hosts the image binary and achieve the same results?  Or, is there some way to upload image binaries to Google ahead of time, and pass some kind of identifier to tell this Image instance to reference that identifier?

                // Create image.
                Image image = new Image();
                image.setData(imageData);
                image.setFileSize(imageSize);
                image.setMimeType(mimeType);

                // assign the image to the imageAd.
                imageAd.setImage(image);

Thanks in advance!

Best,
Adam

Vincent Racaza (AdWords API Team)

unread,
Nov 7, 2017, 12:22:04 AM11/7/17
to AdWords API Forum
Hi Adam,

Please correct me if my understanding is incorrect. From what I have understood, you want to replace the value of setData() to a URL value. If so, then our example (in Java) is already showing this specifically on this line.

Also, you can create an image first using MediaService.upload() (see this example) and later on use the MediaService.get() to get the mediaId on which you will use in creating your ad via AdGroupAdService.mutate().

Thanks,
Vincent
AdWords API Team
Reply all
Reply to author
Forward
0 new messages