Can I read all the fields of a lead via REST api ? | Community
Skip to main content
August 19, 2014
Question

Can I read all the fields of a lead via REST api ?

  • August 19, 2014
  • 6 replies
  • 2607 views
I need to read all the feilds of Lead to prefill some of the marketo form values if they already exist. When I access a lead using the REST api I get only firstname and last name of the lead.

{"requestId":"ca8d#147ef0916dc","result":[{"id":72836,"updatedAt":"2014-08-18T20:51:22+0000","lastName":"doe","email":"john.doe@prnewswire.com","createdAt":"2014-07-21T19:00:21+0000","firstName":"john"}],"success":true}

Is there any parameter that must be set to request additional feilds. Please advice.
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

6 replies

August 19, 2014
Well, you just specify additional fields in the call, as documented here: http://developers.marketo.com/documentation/rest/get-lead-by-id/

You can get a list of fields from the Admin UI of Marketo or we are adding a Describe Lead API call next week, which you could also use.
August 19, 2014
Hi..

Thanks for the reply. But I don't see any documentation for requesting additional feilds on the link you have provided.

Can you please let me know the documentation for requesting additional feilds.
August 19, 2014
Here is how to get a list of fields that can be updated via REST API:
http://developers.marketo.com/documentation/rest/field-names

A
s Eric mentioned, you update lead fields by passing a JSON array:
http://developers.marketo.com/documentation/rest/createupdate-leads/
August 19, 2014
Thanks for the reply. But I I need to just read the lead data using /rest/v1/lead/{id}.json

You can get the fields by adding GET 'fields' parameter with value equal to CSV of fieldnames.
August 21, 2014
no answer for this?

i am looking for an example on how to GET the values from the SOAP api call ...
July 18, 2017

I banged my head on this for a while to get the specific syntax down. Do you need url encoding, do you need [s? do you need quotes? The answer is no. Here's an example:

https://111-ABC-222.mktorest.com/rest/v1/lead/2271601.json?fields=firstName,lastName,email,Custom_Field__c

Hopefully that saves some people some head banging.