SOLVED

REST API to get all lead attributes

Go to solution
Anonymous
Not applicable

REST API to get all lead attributes

Hello,

Is there a way to get all attributes of a lead using the REST API?  Specifically, I would like to pull for any attributes that could be added to a Marketo Form.  Looking at the documentation (Get Lead by Id » Marketo Developers ), I can either get a few basic fields of a lead or I can specify all the fields I want.  I am guessing this may not be possible/desirable due to the amount of potential data that could be returned.

Background on my scenario

From what I understand, Marketo landing page form pre-population works based on the lead associated with a specific cookie.  Setting that lead association can be done by simply entering in an email value on a form and submitting, so I am not comfortable using that in some scenarios (someone can easily populate all form fields by simply knowing the email address).  Instead, I would like to use a form embed on the client, retrieve the lead information via REST call on the server (as a trusted authenticated user), then set each of the form values using that information using generic logic that inspects the form fields available.  Primarily looking for answer to first question, but constructive feedback on alternate ways to achieve this are welcome also!

Thank you.

Eric

Tags (2)
1 ACCEPTED SOLUTION

Accepted Solutions
Kenny_Elkington
Marketo Employee

Re: REST API to get all lead attributes

There's no equivalent to 'SELECT *', if you need all the fields then they need to all be listed.  The easiest way is by using Describe Lead and then iterating through each of the fields that have a rest field name.  It would probably be a good idea to cache both the response from describe and the resulting string of fields, as well.

View solution in original post

2 REPLIES 2
Kenny_Elkington
Marketo Employee

Re: REST API to get all lead attributes

There's no equivalent to 'SELECT *', if you need all the fields then they need to all be listed.  The easiest way is by using Describe Lead and then iterating through each of the fields that have a rest field name.  It would probably be a good idea to cache both the response from describe and the resulting string of fields, as well.

View solution in original post

Anonymous
Not applicable

Re: REST API to get all lead attributes

The describe should help with what I'm trying - thank you Kenny!