REST API Method: search leads with field that contains a specific string ? | Community
Skip to main content
February 9, 2016
Solved

REST API Method: search leads with field that contains a specific string ?

  • February 9, 2016
  • 2 replies
  • 2166 views

Hello,

I created a custom field (OtherEmails__c) which contains all the potential emails that a lead can have (besides its email field). Its format is: "email1@example.com; email2@example.com; email3@example.com". I'd like to get with the REST API method "Get Multiple Leads by Filter Type" all the leads that uses "email1@example.com" (either its default email field or its custom OtherEmails__c field).

First of all, I don't find to do this in only one request, as the method only supports one filterType (not both email and OtherEmails__c at the same time). So I must send a first request on email and if I don't find any result I send a second one on OtherEmails__c. This is too bad but it works.

My real problem is: for my second request, I don't have the full value of OtherEmails__c but only a part of it (for instance "email1@example.com; email2@example.com; email3@example.com" must match if i'm looking for "email1@example.com").

Finally, my questions are: How can I use the REST API method "Get Multiple Leads by Filter Type" to search leads whose filterType field contains one of my filterValues (and not is equal to) ? Should I use an other method ? Do I have to change the field type of OtherEmails__c ? Any advice ?

It would be much appreciated, thank you !

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 Grégoire_Miche2

Hi Lucas,

My understanding is that the Get Multiple Leads by Filter Type » Marketo Developers  API can use custom fields as filters, but you cannot set operators such as "contains". And I never heard that you would pass some * or $...

-Greg

2 replies

Grégoire_Miche2
Grégoire_Miche2Accepted solution
Level 10
February 9, 2016

Hi Lucas,

My understanding is that the Get Multiple Leads by Filter Type » Marketo Developers  API can use custom fields as filters, but you cannot set operators such as "contains". And I never heard that you would pass some * or $...

-Greg

SanfordWhiteman
Level 10
February 9, 2016

Finally, my questions are: How can I use the REST API method "Get Multiple Leads by Filter Type" to search leads whose filterType field contains one of my filterValues (and not is equal to) ? Should I use an other method ? Do I have to change the field type of OtherEmails__c ? Any advice ?

Like Greg said, I don't think there are any operators that would match here.

If you're doing a lot of work like this, I think it's better to replicate your lead database offline (using REST) into SQL and query it that way.  Even if you had the right operators it would probably be slooooooow.