Uploading Image Assets via REST API

118 views
Skip to first unread message

Greg Asquith

unread,
Nov 8, 2021, 6:44:58 AM11/8/21
to AdWords API and Google Ads API Forum
Hi,

I've been uploading Image Assets via the REST API and the assets are successfully uploaded, but when I come to create a responsive display ad using these images, I receive an error message.

This only occurs when cropping an image in the Ad Creation tool within Google Ads to the correct dimensions - uploading and using a square image without cropping does not throw the error.

When I upload the same images manually in the Google Ads platform, the errors do not occur when cropping.

What could be causing images being uploaded through the API to be unable to be cropped?

Thanks

Google Ads API Forum Advisor

unread,
Nov 8, 2021, 1:58:26 PM11/8/21
to adwor...@googlegroups.com
Hi Greg,

I just now uploaded an image via API and cropped it in a responsive display ad in the UI and it saved. Could you give us the steps to see what you are seeing?


Reminder: Share your feedback about the Google Ads (AdWords) API! Take the 2021 Google Ads API and AdWords API Annual Survey

Regards,
 
Google Logo
Aryeh Baker
Google Ads API Team
 


ref:_00D1U1174p._5004Q2R79hV:ref

Greg Asquith

unread,
Nov 8, 2021, 2:16:03 PM11/8/21
to AdWords API and Google Ads API Forum
Hi Aryah,

Thanks for getting back to me - I'm using the REST API through Google Apps Script as follows (The URL is a .png file stored in an AWS S3 bucket):

var headers = {
'developer-token': 'TOKEN',
'Authorization': 'Bearer ' + ACCESS_TOKEN,
'login-customer-id' : 'MANAGER_ACCOUNT_ID',
'Content-type': 'application/json'
};

var blob = UrlFetchApp.fetch(URL).getBlob();
var bytes = blob.getBytes();
var encodedBlob = Utilities.base64EncodeWebSafe(bytes);
var size = blob.getBytes().length;
var name = FILENAME;
var payload = {
'operations': [
{
"create": {
"name" : name,
"imageAsset": {
"mimeType": 'IMAGE_PNG',
"fullSize": {
"heightPixels": IMAGE_HEIGHT,
"widthPixels": IMAGE_WIDTH,
"url": URL
},
"data": encodedBlob,
"fileSize": size
},
}
},
]
};
var options = {
'headers' : headers,
'method' : 'post',
'contentType': 'application/json',
'payload' : JSON.stringify(payload),
"muteHttpExceptions" : true
};
var endpoint = "https://googleads.googleapis.com/v9/customers/"+ACCOUNT_ID+"/assets:mutate";
var response = JSON.parse(UrlFetchApp.fetch(endpoint, options));

The response variable simply contains a Resource Name for the successfully created asset, but when attempting to select/crop the two ratios (1.91:1 and 1:1) and Save, the following error appears in red next to the save button:

There's an error in your selected images. Please remove the image with error before save.

The cropping is successful when uploading the exact same image file manually, so file size or dimensions is not the issue.

Thanks,

Greg Asquith

unread,
Nov 10, 2021, 3:33:51 AM11/10/21
to AdWords API and Google Ads API Forum
Bumping this as an urgent issue please.
Message has been deleted

Google Ads API Forum Advisor

unread,
Nov 10, 2021, 10:51:47 AM11/10/21
to adwor...@googlegroups.com
Hi Greg,

I wasn't able to reproduce this behavior using Upload Image Asset.java. For us to see this on our end, could you reproduce this issue with one of our client libraries? If you can reproduce, we will need the following:
  • A request and response log of API communication for the image upload.  The request and response appears similar to the JSON Mappings in our REST documentation. Our client libraries have loggers with logging instructions, to see these instructions you can click on the client library you use in the sidebar of our client library guide and click on "Logging". Setting the logger to 'DEBUG' will get the desired log. 
  • Step by step instructions in the UI to crop and see this error
Please send the logs privately.

The chances are there is a need to refresh your browser between upload and crop, or there are other things server side that don't register correctly. For these other possibilities you can reach out to product support.


Reminder: Share your feedback about the Google Ads (AdWords) API! Take the 2021 Google Ads API and AdWords API Annual Survey

Regards,

ref:_00D1U1174p._5004Q2R79hV:ref

Greg Asquith

unread,
Nov 10, 2021, 11:53:29 AM11/10/21
to AdWords API and Google Ads API Forum
Hi,

I have reproduced the error using the Python library and replied privately with logs and a screenshare of the platform error.

Thanks,

Google Ads API Forum Advisor

unread,
Nov 10, 2021, 2:41:42 PM11/10/21
to adwor...@googlegroups.com, gr...@ad-lib.io
Hi Greg,

Thank you for sharing the video and the logs, I reproduced this behavior where a picture uploaded via API didn't get a saved crop while an upload in the UI did get cropped and saved for the ad. I shared this with my team and we will get back to you as soon as possible.


Reminder: Share your feedback about the Google Ads (AdWords) API! Take the 2021 Google Ads API and AdWords API Annual Survey

Regards,
 

Greg Asquith

unread,
Nov 15, 2021, 6:38:52 AM11/15/21
to AdWords API and Google Ads API Forum
Hi,

Has there been an update on this issue please?

Thanks

Greg Asquith

unread,
Nov 17, 2021, 1:30:22 PM11/17/21
to AdWords API and Google Ads API Forum
Hi,

Apologies for chasing again, but this is a breaking issue in process at the moment.

Thanks,

Reply all
Reply to author
Forward
0 new messages