Trying to use CreativeAssets.insert in Google Apps Script

156 views
Skip to first unread message

Philippe van Amerongen

unread,
Mar 30, 2017, 10:48:58 AM3/30/17
to Google's DoubleClick Campaign Manager API Forum
Hi,

I am trying to upload a .zip or .adz file in order to add a creative asset in a creative.
The struggle is in using DoubleClickCampaigns.CreativeAssets.insert(resource, profileId, advertiserId, mediaData).

I always get the following error using that function: 
9015 : You can only upload HTML5 assets in a .zip or .adz file. Reach out to the creative developer to resolve this issue by correcting the extension.

I also tried it with a sample zip file (located at: https://support.google.com/dcm/partner/answer/3145300?hl=en) and some images (changing the "type" field in the "assetIdentifier" from "HTML" to "IMAGE"), but it never works.

The code is as follows (all the variables are filled in properly):
var file = DriveApp.getFileById(fileId);
var mediaData = file.getBlob().setContentExtension("application/zip");
var resource = {
 
"kind": "dfareporting#creativeAssetMetadata",
 
"assetIdentifier": {
   
"type": "HTML",
   
"name": name
 
}
}
DoubleClickCampaigns.CreativeAssets.insert(resource, profileId, advertiserId, mediaData);


I also tried fetching a file with UrlFetchApp instead of getting it from Google Drive, but my preferred method is using Google Drive.


Thanks in advance!

Lakshmi(DCM API Team)

unread,
Mar 30, 2017, 3:01:22 PM3/30/17
to Google's DoubleClick Campaign Manager API Forum
Hi,

Please validate the zip file using HTML5 validator. Did you try uploading this zip file in UI? I recommend to go through the  'Prepare and upload HTML5 assets' in the help center article that you linked.

I suggest contacting Appscript support to check if anything needs to be done to get the zip file from Drive.

Thanks,
Lakshmi, DCM API Team

Philippe van Amerongen

unread,
Apr 7, 2017, 10:19:33 AM4/7/17
to Google's DoubleClick Campaign Manager API Forum
Hi,

Thank you for the response!
I checked and it appears that it does not support .adz files within the zip. That is maybe why it works with the UI but not with the API.
I will try to upload separate .adz files.

Regards,
Philippe

Lakshmi(DCM API Team)

unread,
Apr 7, 2017, 3:10:51 PM4/7/17
to Google's DoubleClick Campaign Manager API Forum
Hi Philippe,

This article includes how to handle .adz files. Please let me know if you have any further questions on this.

Thanks,
Lakshmi, DCM API Team

a...@careforads.com

unread,
Apr 14, 2017, 12:03:17 PM4/14/17
to Google's DoubleClick Campaign Manager API Forum
Hi,

I try to upload an asset, but I get an error (I even try the html5 zip file sample), but nothing his working, can you help?

Here my code

creative_asset = {
'assetIdentifier': {
'name': 'test',
'type': 'HTML'
}
}

path_to_asset_file = '/flask/Data/tmpFiles/psf_californie_leaderboard_v3.zip'
media = MediaFileUpload(path_to_asset_file, mimetype='application/zip')
response = acc.service.creativeAssets().insert(
advertiserId='4994331',
profileId=acc.profile_id,
media_body=media,
body=creative_asset).execute()


Thanks in advance

Lakshmi(DCM API Team)

unread,
Apr 14, 2017, 3:29:11 PM4/14/17
to Google's DoubleClick Campaign Manager API Forum
Hi,

Give a try by giving the name as 'test.zip'. I recommend checking with Apps script support if the 'MediaFileUpload' is available to use or not. 

A. Schwibbe

unread,
Jul 26, 2018, 4:05:22 PM7/26/18
to Google's DoubleClick Campaign Manager API Forum
Any solution to this?

Thanks.
A.

Lakshmi Prathipati (DCM API Team)

unread,
Jul 27, 2018, 3:06:37 PM7/27/18
to Google's DoubleClick Campaign Manager API Forum
Hi,

I recommend trying to do the same operation in the UI. In the API request, you need to give the file extension as well (test.zip) for the name. If you are still facing an issue, I need the following details in a private message:
  1. API request and response
  2. DCM account id
  3. Profile id
  4. Timestamp of the API request
I suggest starting a new thread for this issue.

Thanks,
Lakshmi, DCM API Team

On Thursday, July 26, 2018 at 4:05:22 PM UTC-4, A. Schwibbe wrote:
Any solution to this?

Thanks.
A.

Am Freitag, 14. April 2017 18:03:17 UTC+2 
Hi,
Reply all
Reply to author
Forward
0 new messages