What is the post body to create a custom object via the API? | Community
Skip to main content
Danielle_LaFort
Level 2
December 4, 2017
Question

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

  • December 4, 2017
  • 3 replies
  • 5597 views

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

      }

   ]

}

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

3 replies

Danielle_LaFort
Level 2
December 4, 2017

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

Level 5
December 4, 2017

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

Danielle_LaFort
Level 2
December 4, 2017

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.

Level 5
December 4, 2017

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

Kenny_Elkington
Adobe Employee
Adobe Employee
December 5, 2017

The API you're referring to is only for creating and updating custom object records, we do not currently offer an API for managing custom object ​types​.

Level 6
December 5, 2017

ahh, you are right.   There isn't a way to create the custom object type. Thanks for the help as I'm figuring out the same problem as Danielle. Any idea if that's on the roadmap (?)