Get Multiple Leads by Filter Type - returning empty results | Community
Skip to main content
January 9, 2015
Solved

Get Multiple Leads by Filter Type - returning empty results

  • January 9, 2015
  • 3 replies
  • 2102 views
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
This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Jep_Castelein2
When you created the Leads, did you also use Associate Lead to associate them with the Cookie ID? 

3 replies

Jep_Castelein2
Jep_Castelein2Accepted solution
Level 10
January 9, 2015
When you created the Leads, did you also use Associate Lead to associate them with the Cookie ID? 
January 9, 2015
Thanks for your quick reply!

I did not us Associate Lead originally.  However, I just tried that (create the lead with 1st REST call, then associate with the 2nd REST call).  After doing that, I am able to fetch using filterType=cookie.

So that's progress, thanks!  Do you know if it's possible to create & associate the lead with the cookie all in one REST call?  Reading the docs for Create/Update Leads, I don't see any mention of where/how to pass the _mkto_trk cookie.  I was hoping I could do it in one call.

Thanks again,
John
 
Jep_Castelein2
Level 10
January 9, 2015
Not currently available in a single call, but I'll pass it on to product management.