Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

185
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda