What is the post body to create a custom object via the API?

Highlighted

What is the post body to create a custom object via the API?

the docs give this but this seems to only be for updating a custom object.  Does anyone know how to create a custom object (that did not exist before) via the API?

http://developers.marketo.com/rest-api/lead-database/custom-objects/#create_and_update

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

{

   "action":"updateOnly",

   "dedupeBy":"dedupeFields",

   "input":[

      {

         "vin":"19UYA31581L000000",

         "siebelId":"f2676861b5fb",

         "make":"BMW",

         "model":"3-Series 330i",

         "year":2003

      },

      {

         "vin":"29UYA31581L000000",

         "siebelId":"f2676861b5fc",

         "make":"BMW",

         "model":"3-Series 330i",

         "year":2003

      },

      {

         "vin":"39UYA31581L000000",

         "siebelId":"f2676861b5fd",

         "make":"BMW",

         "model":"3-Series 330i",

         "year":2003

      }

   ]

}

12 REPLIES 12
Highlighted

Re: What is the post body to create a custom object via the API?

Is it possible that there is no way to create the custom object definition via the API?

Highlighted

Re: What is the post body to create a custom object via the API?

Hi Danielle,

I think what you're looking for is more along the lines of syncing custom objects, /rest/v1/customobjects/{customObjectName}.json > check this one out.

(Inserts, updates, or upserts custom object records to the target instance. Required Permissions: Read-Write Custom Object)

As you can see the action has the options: = ['createOnly', 'updateOnly', 'createOrUpdate'],

Where createOrUpdate would be your choice. But as this is optional it may be possible to omit this value, it's worth a test post.

Best, Erik

Highlighted

Re: What is the post body to create a custom object via the API?

Thank you Erik, but I don't think I'm asking this correctly.

The CreateOnly seems to only create one if the definition has already been made in the UI first.

I get an error if the custom object was not already defined in the UI:

{

    “requestId”: “161bd#160230393df”,

    “success”: false,

    “errors”: [

        {

            “code”: “1013",

            “message”: “Custom object ‘hello’ not found”

        }

    ]

}

If you can please let me know if I can make a custom object that didn't already exist in the UI, it would be appreciated.  Thanks.

Highlighted

Re: What is the post body to create a custom object via the API?

Hmm, what does your post look like?

Are you adding a custom object to the lead or are you trying to actually define a "whole new" custom object that has not been defined/approved in the Marketo Admin area?

Edit: Have you created and approved a Custom Object in Admin like this? Create Marketo Custom Objects - Marketo Docs - Product Documentation

Highlighted

Re: What is the post body to create a custom object via the API?

Yes, that is right.  I'd like to define a whole new custom object that has

not been defined/approved in the Marketo Admin area.  Is that possible to

do completely via the API?

Also, if I were to add it just to the lead, as you say first, is that

possible as well via just the API?

Highlighted

Re: What is the post body to create a custom object via the API?

Replied above to my previous comment.

The data structure needs to be defined in order to update a custom object since the whole point is to create a small data model that you filter entries.

If you were to be creating completely new definitions of Custom Objects via the API, you would probably risk a huge data mess.

Considering the fact that a Custom Object can house multiple different fields, why would you want to define a Custom Object via the API instead of just creating it in Admin first and pushing data to that CO?

Re: What is the post body to create a custom object via the API?

Thank you. This has been very helpful. To recap:

A custom object must be defined/approved in the UI before I am able to

create them or update them via the API.

<http://www.cloud-elements.com> *Danielle Laforte

| Sales Engineer*

danielle@cloud-elements.com

Cloud Elements | www.cloud-elements.com

3001 Brighton Blvd #642 Denver, CO 80216

<http://signatures.cloud-elements.com/uc/5755d4a753ce430018a5c21c>

<http://signatures.cloud-elements.com/uc/5755d4a753ce430018a5c21c/watermark>

On Mon, Dec 4, 2017 at 1:27 PM, Erik Heldebro <marketingnation@marketo.com>

Highlighted

Re: What is the post body to create a custom object via the API?

No problem!

Exactly, since there are a few fields (for example marketoGUID) that need to be referenced for the correct custom object to be updated.

Highlighted
Level 5

Re: What is the post body to create a custom object via the API?

Hi Danielle,

There is a beta endpoint that will allow you to define custom object schema. It was handed out during an API office hours a few weeks ago.  If you follow me or DM me I can send it over if it will help.