Re: REST API - how to pass the munchkin id/cookie

Anonymous
Not applicable

REST API - how to pass the munchkin id/cookie

We've been working on an integration using the new REST API and can't figure this out: we want to be able to offer to pre-fill the form if they've got a Marketo cookie.  But we haven't found/figured out a way to pass the cookie/munchkin ID into the REST API to get the required form/lead information back to pre-fill the form.

I've seen examples of this with the SOAP API, but is there a way to do this with the REST API?

Thanks!
Tags (1)
6 REPLIES 6
Anonymous
Not applicable

Re: REST API - how to pass the munchkin id/cookie

Here is code available on GitHub that describes using SOAP API and the user's cookie to get data about user in real-time:
https://github.com/mozz100/marketo-whodat/blob/master/class.marketoapi.php

I would follow this approach, and query this endpoint with the cookie id:
http://developers.marketo.com/documentation/rest/get-multiple-leads-by-filter-type/

I have not tested this out, but this would be the first thing I would try. 
Anonymous
Not applicable

Re: REST API - how to pass the munchkin id/cookie

I understand how to use the endpoint - the question that I have is how pass the cookie ID to the backend.  I don't see any call with the munchkin that exposes the ID so that I can then pass it to a backend system.

But maybe I'm thinking about this incorrectly, so instead I'll describe the use case: I've got a form on our website - we create and manage the form (no Marketo).  I want to be able to check if the person has a Marketo cookie and lead information, and automatically pre-populate the form.  This is the way it works with Marketo landing pages, but unfortunately this is not available in Forms 2.0.  As a result, I'm trying to setup the API to both submit the info to Marketo, and to check if a lead exists already and pre-populate.

If it matters, we're using AngularJS on the frontend and then storing the actual code for hitting the REST API in a Node application.
Anonymous
Not applicable

Re: REST API - how to pass the munchkin id/cookie

I am interested in this as well. I am very new to working with REST APIs and Marketo and can't seem to find any way to get a leads ID to be able to send it along to add them to a list or pull back their information to auto fill the form. It seems that it should be very easy, but I cannot find any information that tells me how to do this. Please help!

Thanks
Anonymous
Not applicable

Re: REST API - how to pass the munchkin id/cookie

Solution I have found is to use the Associate Lead Function of the Munchkin. REST API can do all the rest, but to associate a lead with the cookie you need to use the Munchkin. I think the SOAP API works to do this as well, but the REST API does not and it appears that they have no plans to put that functionality into it. However it is possible to Autofill forms using the REST API and the Munchkin together.
Anonymous
Not applicable

Re: REST API - how to pass the munchkin id/cookie

Maybe this is new, but it appears the REST API has the associate lead function now.

http://developers.marketo.com/documentation/rest/associate-lead/
Anonymous
Not applicable

Re: REST API - how to pass the munchkin id/cookie

Hi,

the REST API has a new function called associate-lead. I will be passing the cookie and the the response will be the lead id. Once you have its ID you can fetch all the lead information using: Get Lead by Id » Marketo Developers

Just keep in my that you can not update a anonymous lead, if it's your case. You need to make it a "known lead" before you update the lead information.