I'm brand new to Marketo, and I am stuck on a problem with the "Get Multiple Leads by Filter Type" REST API call.
When I use this API with filterType=email, I get lead data back as expected.
When I use this API with filterType=cookie, I get back a result which has an empty result:
StatusCode = 200
{"requestId":"ee47#14acf571eeb","result":[],"success":true}
The request looks like this:
https://076-WSM-660.mktorest.com/rest/v1/leads.json?filterType=cookie&filterValues=id:076-WSM-660%26token:_mch-pcm.com-1420815979885-96936&fields=firstName,lastName,phone,inferredCompany,cookies
I am getting the filterValue value from the "_mkto_trk" cookie, and escaping the ampersand as suggested in some other discussions.
It's probably worth mentioning that I created the lead using the Create/Update Leads API -- maybe there is something I'm doing wrong there? Here is how I'm creating the lead:
POST URL:
https://076-WSM-660.mktorest.com/rest/v1/leads.json
BODY:
{"action":"createOrUpdate","input":[{"firstName":"john","lastName":"9jan_1044am","email":"9jan_1044am@foo.com","phone":1231231234,"title":"something"}]}
I can see the leads being created in the Marketo admin's "all leads" view, so I assumed that part was working, but now I'm wondering if the lead is not associated with the cookie somehow. I am including the munchkin initialization in my page:
Munchkin.init("076-WSM-660");
Update: When I fetch one of these leads I created (using filterType=email), and request the "cookies" field, the value comes back null:
{"requestId":"e2a6#14acf9d3389","result":[{"id":30,"lastName":"9jan_1150am","phone":"1231231234","email":"9jan_1150am@foo.com","inferredCompany":null,"firstName":"john",
"cookies":null}],"success":true}
It looks like the _mkto_trk cookie is not associated with the lead...?
What am I missing? I'm pretty stumped!
John