Push Lead to Marketo API endpoint - format?

Phillip_Wild
Level 10 - Community Advisor

Push Lead to Marketo API endpoint - format?

Hi guys

I'm really struggling to write to a Marketo custom field using the "Push Lead to Marketo" REST API endpoint here: http://developers.marketo.com/rest-api/endpoint-reference/lead-database-endpoint-reference/#!/Leads/...

I'm using Postman for the request, with this format:

POST request: https://(our endpoint)/rest/v1/leads/push.json?access_token=(token values here)&(field name to updat...

In my headers I have: content-type application/json

For my raw body I have:

{

  "input": [

    {

      "id": 10042475

       }

  ]

,

  "programName": "(name of the program)"

}

I get the following error message:

{

  "requestId": "10a9b#157714c3515",

  "result": [

    {

      "status": "skipped",

      "reasons": [

        {

          "code": "1003",

          "message": "Field 'id' not allowed"

        }

      ]

    }

  ],

  "success": true

}

Why would the field "id" not be allowed? What am I missing here? Apologies, I'm not a coder by profession so I'm feeling my way around here.

As a side note, the documentation says that "programName" is optional, so I'm not sure why I need that (but when I remove it, I get an error that it is required).

Thanks, any help appreciated.

Phil

Tags (1)
2 REPLIES 2
SanfordWhiteman
Level 10 - Community Moderator

Re: Push Lead to Marketo API endpoint - format?

You have to set "lookupField" : "id" if you're going to key on id.  Otherwise, you'd be trying to update the ID of a record, which isn't possible in the database.

Phillip_Wild
Level 10 - Community Advisor

Re: Push Lead to Marketo API endpoint - format?

Thanks Sanford! That's working perfectly.

Here's my updated code:

POST to URL: https://(our endpoint)/rest/v1/leads/push.json?access_token=(token)

{

  "input": [

    {

      "id": "(insert ID here)",

      "(field name to update)": "(value for field)"

   

       

        }

  ]

,

  "programName": "(program name)",

   "lookupField": "id"

}