Skip to main content
John_M
Adobe Employee
Adobe Employee
Oct 9, 2015 5:55 PM UTC

Custom Objects in Marketo - Part 2 - REST API

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:

Create/Update Custom Objects

Request

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

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.

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

7 replies

Nov 19, 2015 7:45 PM UTC

Great post!

BTW: you need to update your part III link above to: Custom Objects in Marketo - Part 3 - SOAP API

Translate
John_M
Adobe Employee
John_MAdobe EmployeeAuthor
Adobe Employee
Mar 15, 2017 8:57 PM UTC

Thanks Kevin Bickelmann​ !!! I updated that link.

Translate
Jan 30, 2018 1:51 PM UTC

Can you add syntax for GET custom object?  Newbee looking for starting code.

Translate
Level 2
Sep 28, 2021 4:06 PM UTC

What if I want to upload a file with 32524 fields in csv format?

Translate
SanfordWhiteman
User Group Leader
User Group Leader
Oct 5, 2021 5:51 AM UTC

What if I want to upload a file with 32524 fields in csv format?

Not sure I understand. You can’t have 32524 fields on a Custom Object record.

Translate
Jo_Pitts1
Community Advisor
Community Advisor
Oct 5, 2021 7:42 PM UTC

@sanfordwhiteman and @darthzeran and why would you want to?

Is this the weirdest troll in the world? 

Translate
Level 2
Oct 11, 2021 2:53 PM UTC

To bad I can't downvote the comments that hurt my heart @jo_pitts1 .

@sanfordwhiteman This ties in to whatever previous questions I asked last week about file sizing.  
In the example above, OP only provides sending 1 object to Marketo each time.  I had a file with 32524 custom objects that had to be updated, but in the example, there was only 1 being uploaded.

But the problem was solved when we realized Adobe is 10,000,000 bytes max, not 1024*1024*10 bytes max, so we could just use a file uploader, instead of a custom API call with each line like above

Translate