Sathya
Sathya

Reputation: 233

Marketo - How to save complex object in Lead Database?

I was asked to store leads like below in Marketo's lead database through rest api "POST /rest/v1/leads.json".

{
  "action": "createOnly",
  "lookupField": "email",
  "input": [{
      "email": "[email protected]",
      "firstName": "Kataldar-1",
      "postalCode": "04828",
      "property": [{
          "type": "land",
          "status": "available"
        },
        {
          "type": "car",
          "status": "sold out"
        },
        {
          "type": "bike",
          "status": "sold out"
        },
        {
          "type": "laptops",
          "status": "available"
        }
      ]
    },
    {
      "email": "[email protected]",
      "firstName": "Kataldar-2",
      "postalCode": "04828",
      "property": [{
          "type": "land",
          "status": "sold out"
        },
        {
          "type": "car",
          "status": "available"
        },
        {
          "type": "bike",
          "status": "sold out"
        },
        {
          "type": "laptops",
          "status": "available"
        }
      ]
    }
  ]
}

Input field is not in flat json structure. What could be the best approach? Do I really need to use custom objects in this case? Can I dump "property" object as it is in the lead database and use velocity script to parse it ?

Upvotes: 0

Views: 88

Answers (2)

Pratik Somaiya
Pratik Somaiya

Reputation: 743

You can create a List<Dictionary<string,object>> in C# and retrieve the data and then store it using Entity Framework.

I am considering .Net framework in this case

Upvotes: 0

nakashimaotsu
nakashimaotsu

Reputation: 1

If 'Property' is a custom object, you'll want to call that separately for the record and associated the record with that object via the custom object API

So you can push (create) the record first and then associate (add) the custom object to the record.

Upvotes: 0

Related Questions