API Lead response returns empty result array half of the time | Community
Skip to main content
August 11, 2015
Question

API Lead response returns empty result array half of the time

  • August 11, 2015
  • 3 replies
  • 4121 views

I am using Marketo REST API to get lead information, and I apply a filter of _mkto_trk cookie value.

My request looks like: https://078-whz-188.mktorest.com/rest/v1/leads.json?filterType=cookie&filterValues={cookie_value}&access_token={api_token}

Half of the time it works great, but then many times I get an empty result array back. What can be the reason for that? I even waited for an hour after new cookie was created, but still I see empty result array. Here is a screenshot:

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

3 replies

Kenny_Elkington
Adobe Employee
Adobe Employee
August 11, 2015

This means that the request was successful, but there were no results.  If you're using the cookie to retrieve by, the call will not be able to retrieve the record if it is anonymous, so this is likely this issue you're experiencing.  The lead needs to become known prior to becoming accessible via the API.

August 11, 2015

Sure, but when I try to access same after a few hours, I do see result in the API response for the same cookie.

Does it take any time for leads to sync and be available via cookie filter?

Also, I do not entirely understand what you mean by anonymous here? All the leads are going into marketo the same way, via a PHP curl submission. Not sure why would lead id be available for only half of them.

Here is the flow that leads follow:

  1. Lead fills a form
  2. We submit form via a PHP curl
  3. We query Marketo API, using their cookie id to get there lead id(this is where result is empty half of the time)

Thanks for the quick response.

Kenny_Elkington
Adobe Employee
Adobe Employee
August 11, 2015

By anonymous leads I mean this.  Are you able to access the lead via the UI at the same time that your call returns no results?  Does the lead have web activity(such as Visits Web Page)available in its activity log?

March 27, 2017

Hello - was there ever a resolution provided for this question?  I am encountering a similar issue.  Thank you!

SanfordWhiteman
Level 10
March 28, 2017

Is it a similar issue, or this exact issue?  Because this is specifically linked to the filter type of Cookie and people often don't understand the requirements for this filter.

March 28, 2017

I am having the exact same issue - sometimes I get an empty result set back, but not every single time (even with the same cookie value).  Can you expand on your note about the filter type of Cookie and it's requirements? Thank you!

May 26, 2017

Anyone else having this issue - `_mkto_trk` has an ampersand that needs to be encoded to %26 in order for the filter to function properly.

SanfordWhiteman
Level 10
May 26, 2017

`_mkto_trk` has an ampersand that needs to be encoded to %26 in order for the filter to function properly.

I don't see how this is possible unless you're crafting your own cookies.

The Munchkin cookie creation algorithm can't include ampersands.