Here is code available on GitHub that describes using SOAP API and the user's cookie to get data about user in real-time:
I would follow this approach, and query this endpoint with the cookie id:
I have not tested this out, but this would be the first thing I would try.
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.
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!
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.
Maybe this is new, but it appears the REST API has the associate lead function now.
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 http://developers.marketo.com/documentation/rest/get-lead-by-id/
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.