API Lead response returns empty result array half of the time

Anonymous
Not applicable

API Lead response returns empty result array half of the time

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:

Screen Shot 2015-08-11 at 1.58.40 PM.png

11 REPLIES 11
Kenny_Elkington
Marketo Employee

Re: API Lead response returns empty result array half of the time

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.

Anonymous
Not applicable

Re: API Lead response returns empty result array half of the time

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
Marketo Employee

Re: API Lead response returns empty result array half of the time

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?

Anonymous
Not applicable

Re: API Lead response returns empty result array half of the time

It takes around 30s to a minute for a lead to show up.

SanfordWhiteman
Level 10 - Community Moderator

Re: API Lead response returns empty result array half of the time

Aujasvi, beyond Kenny's questions, what is the business process that requires a server-side POST? You create the possibility of a DoS attack against your instance (when form post and/or API call limits are exceeded) so you should make sure to exhaust all client-side alternatives first. What is the process of data gathering/enhancement?

Anonymous
Not applicable

Re: API Lead response returns empty result array half of the time

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

SanfordWhiteman
Level 10 - Community Moderator

Re: API Lead response returns empty result array half of the time

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.

Anonymous
Not applicable

Re: API Lead response returns empty result array half of the time

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!

SanfordWhiteman
Level 10 - Community Moderator

Re: API Lead response returns empty result array half of the time

Same cookie value, different results = open a Support ticket.