Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

184
Views
How to pass creativeId into CampaignCreativeAssociations.insert() method using Google CM360 API

I'm using Google Apps Script and using the DoubleClickCampaigns services v3.5, which allows me to use CM360 APIs v3.5

I'm trying to associate a creative to a campaign using campaignCreativeAssociations.insert()

  const profileId = '1234' //fake
  const campaignId = '12345'
  const creativeId = '5551234'
  DoubleClickCampaigns.CampaignCreativeAssociations.insert(profileId,campaignId,creativeId);

The above returns this error

 GoogleJsonResponseException: API call to dfareporting.campaignCreativeAssociations.insert failed with error: 8058 : Creative ID required.

Using the "Try this method" on the side bar of the documentation site has a sample code shows that I should instead pass in an object into the .insert parameter

 {"profileId":###,"campaignId",###,resource:{"creativeId":###}} 

Testing the code by running it on the documentation website (it works on live data) I can confirm that the creative was associated to the campaign.

function execute() {
    return gapi.client.dfareporting.campaignCreativeAssociations.insert({
      "profileId": 123,
      "campaignId": 456,
      "resource": {
        "creativeId": 123,
      }
    })

However when I try to rebuild the same code into my Apps Script environment, I get this error

DoubleClickCampaigns.CampaignCreativeAssociations.insert({
  "profileId": 123,
  "campaignId": 555,
  "resource": {
    "creativeId": 555123,
  }
})



Exception: Invalid number of arguments provided. Expected 3-4 only

Is the issue with the parameter? Following the sample code gives me an error regarding passing the wrong number of parameters. What should my code me so that I can use Apps Script to insert creatives into a CM360 campaign

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

It seems that the arguments of DoubleClickCampaigns.CampaignCreativeAssociations.insert() are as follows.

insert(resource: Dfareporting_v3_5.Dfareporting.V3_5.Schema.CampaignCreativeAssociation, profileId: string, campaignId: string)

When this is reflected to your script, how about the following modification?

Modified script:

var resource = { "creativeId": 555123 };
var profileId = "123";
var campaignId = "555"
DoubleClickCampaigns.CampaignCreativeAssociations.insert(resource, profileId, campaignId);
  • It seems that the values of profileId and campaignId are the string type.

Reference:

  • Method: campaignCreativeAssociations.insert
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!