What is the format of tokens and leads(input json format) used in request campaign rest api? I am getting error code 609 with message Invalid value specified for attribute 'null' .

Anonymous
Not applicable

What is the format of tokens and leads(input json format) used in request campaign rest api? I am getting error code 609 with message Invalid value specified for attribute 'null' .

What is the format of tokens and leads(input json format) used in request campaign rest api? I am getting error code 609 with message Invalid value specified for attribute 'null'.

Please provide some example for the integration purpose.

Tags (1)
10 REPLIES 10
Grégoire_Miche2
Level 10

Re: What is the format of tokens and leads(input json format) used in request campaign rest api? I am getting error code 609 with message Invalid value specified for attribute 'null' .

Hi Jatin,

Paste your code, it will be easier to help you.

-Greg

Anonymous
Not applicable

Re: What is the format of tokens and leads(input json format) used in request campaign rest api? I am getting error code 609 with message Invalid value specified for attribute 'null' .

Hi Greg,

It is the same sample java code as given in request campaign rest api page.Here is the snippet for the input format.

public static void main(String[] args){

  RequestCampaign requestCampaign = new RequestCampaign();

  requestCampaign.id = 1079;

  requestCampaign.leadIds = new int[]{40};

  JsonObject myToken = new JsonObject()

  .add("name", "{{my.number}}")

  .add("value", "123456");

  requestCampaign.tokens = new JsonObject[]{myToken};

  System.out.println(requestCampaign.buildRequest());

  String result = requestCampaign.postData();

  System.out.println(result);

  }

The input json is printed in this format - {"input":{"leads":[40],"tokens":[{"name":"{{my.number}}","value":"123456"}]}}

Please reply. your help will be highly appreciated.

-Jatin

SanfordWhiteman
Level 10 - Community Moderator

Re: What is the format of tokens and leads(input json format) used in request campaign rest api? I am getting error code 609 with message Invalid value specified for attribute 'null' .

The "leads" prop is an array of object { id:<int> id }. You are passing an array of integers.

Anonymous
Not applicable

Re: What is the format of tokens and leads(input json format) used in request campaign rest api? I am getting error code 609 with message Invalid value specified for attribute 'null' .

Hi Sanford,

Thanks for your reply. Actually i am using same code as mentioned in  Request Campaign » Marketo Developers  and in this it is mentioned that we have to pass only id. So , can you guide me how to use this in correct way with some example as i am new to this.

Regards

Jatin

Anonymous
Not applicable

Re: What is the format of tokens and leads(input json format) used in request campaign rest api? I am getting error code 609 with message Invalid value specified for attribute 'null' .

Is this the correct way to use it.

requestCampaign.leadIds = new JsonObject().add("id",41);
SanfordWhiteman
Level 10 - Community Moderator

Re: What is the format of tokens and leads(input json format) used in request campaign rest api? I am getting error code 609 with message Invalid value specified for attribute 'null' .

Actually i am using same code as mentioned in Request Campaign » Marketo Developers

Not really.  You left out this critical part:

  JsonArray leads = new JsonArray();

  int i;

  for (i = 0; i < leadIds.length; i++) {

   leads.add(leadIds[i]);

  }

Please look at the whole code sample.  It's not perfectly intuitive but you're missing parts.

it is mentioned that we have to pass only id.

No, it's not.

Anonymous
Not applicable

Re: What is the format of tokens and leads(input json format) used in request campaign rest api? I am getting error code 609 with message Invalid value specified for attribute 'null' .

Hi Sanford,

can you please share a working snippet and how to use multiple id's with request campaign api.

SanfordWhiteman
Level 10 - Community Moderator

Re: What is the format of tokens and leads(input json format) used in request campaign rest api? I am getting error code 609 with message Invalid value specified for attribute 'null' .

Each lead identifier is a small JSON object, not just an int:

"leads" : [

{

      "id" : 12234

},

{

      "id" : 12235

}

]

So you need to wrap each lead ID in an instance of JSONObject.

Anonymous
Not applicable

Re: What is the format of tokens and leads(input json format) used in request campaign rest api? I am getting error code 609 with message Invalid value specified for attribute 'null' .

I am following you but didn't getting the necessary changes that you are suggesting. Currently to get the output, i am using this.

public JsonObject[] leadIds;

JsonObject myLeads = new JsonObject().add("id", "40");

  JsonObject myLeads1 = new JsonObject().add("id", "41");

  requestCampaign.leadIds = new JsonObject[]{myLeads,myLeads1};

It is giving me correct output, but can you give something more optimized in accordance with the code.