John Mattos

Custom Objects in Marketo - Part 2 - REST API

Blog Post created by John Mattos Employee on Oct 9, 2015

Next up, the REST API, which is, relatively speaking, a new thing. The custom object parts of the REST API are documented on the developer blog on their own separate page, and in my opinion it makes sense to monitor that page for changes so you know when the API has new features added.

 

For the purposes of this, I'll be referencing the Automobile object that I created in part 1 of this series, and I'll be using Postman to make my REST calls. (note you can read about use of the SOAP api in Part III of the series) Here's what it looks like:

 

Screen Shot 2015-07-07 at 6.16.40 PM.png

 

Create/Update Custom Objects

Request

http://491-XYZ-299.mktorest.com/rest/v1/customobjects/automobile_c.json?access_token=3471-4804-afd9-e9925fd632f9:sj

 

jSON Payload

{

  "action": "createOrUpdate",

  "dedupeBy": "dedupeFields",

  "input": [

    {

      "bodystyle": "Coupe",

      "color": "Silver",

      "make": "Hyundai",

      "model": "Sonata Hybrid",

      "year": "2015",

      "vinnumber": "KMHEC4A4XFA129411",

      "emailaddress": "jmattos@marketo.com"

    }

  ]

}

 

Response

{

  "requestId": "8ca7#14e6ad1cc70",

  "result": [

    {

      "seq": 0,

      "status": "created",

      "marketoGUID": "98f652e8-e8f0-47b1-a1f7-18dc005007c3"

    }

  ],

  "success": true

}

 

Delete Custom Objects

Request

http://491-XYZ-299.mktorest.com/rest/v1/customobjects/automobile_c/delete.json??access_token=3471-4804-afd9-e9925fd632f9:sj

 

jSON Payload

{

   "deleteBy":"dedupeFields",

   "input":[

      {

        "emailaddress":"jmattos@marketo.com",

        "vinnumber":"KMHEC4A4XFA129411"

      }

   ]

}

 

Response

{

  "requestId": "ed07#14e6b34c01e",

  "result": [

    {

      "seq": 0,

      "status": "deleted",

      "marketoGUID": "6c485902-3663-4b0b-adfd-e183e33cb285"

    }

  ],

  "success": true

}

 

So there you have it. a Sample REST call to Create a custom object, and one to Delete a custom object. The other calls are really quite similar.

Outcomes