Bitrix24 Community

Support » Forum » Marketplace » REST API example on how to do a wildcard search
Pages: 1
RSS
REST API example on how to do a wildcard search, Need a REST API example on how to do a wildcard search for finding contacts in the CRM
From an external system I want to use the crm.contact.list to search for contacts by the first and last name.  Where can I get an example on how to do this, both url encoded and pre-url encoded?

Here is a url encoded filter call that works to find the Last Name of 'Smith':
Code
https://myaccount.bitrix24.com/rest/crm.contact.list.json?=&FILTER%5BLAST_NAME%5D=Smith&ORDER%5BLAST_NAME%5D=ASC&auth=some_auth_code

The filter information un-encoded appears to be this:
&FILTER[LAST_NAME]=Smith
&ORDER[LAST_NAME]=ASC

I need to do something like find all contacts that match by wildcard, as in find first and last names that have 'sm' in them.  I've tried it with * as the wildcard but it doesn't work:

&FILTER[LAST_NAME]=*sm*
&FILTER[FIRST_NAME]=*sm*
&ORDER[LAST_NAME]=ASC
Edited: Steve Kinyon - 01/09/2016 03:57:11
Hi Steve,

Please see the REST API help or contact one of our certified partners to help.

Best,

Yana.
Thank you but I have been referring to the REST API.  Here is the page:

 https://training.bitrix24.com/rest_help/crm/contacts/crm_contact_list.php

This is the only example and it is using the Javascript Library. The Javascript Library doesn't appear to support usage in external systems.

This is the call I'm modeled the REST API call from:

       BX24.callMethod(
           "crm.contact.list",
           {
               filter: { "PHONE": "555888" },
               select: [ "ID", "NAME", "LAST_NAME" ]
           },
           function(result)
           {
               if(result.error())
                   console.error(result.error());
               else
               {
                   console.dir(result.data());  
                   if(result.more())
                       result.next();      
               }
           }
       );

You can see in my first post that I've done the translation to make the API work despite the lack of documentation, but I need to know more about the 'filter:' argument.

There appears to be no documentation around 'filter:'.  I noticed some list calls have date examples using <>= but nothing on searching text.

A working example like I've asked for above would help a lot.  A full list of 'filter:' arguments with the REST API & Javascript examples would be best.

Regards,

Steve Kinyon
Edited: Steve Kinyon - 01/11/2016 19:52:18
Please submit a ticket to our Helpdesk with these details, thanks.

Best,

Yana.
Pages: 1
2,000,000+
organizations
are already using Bitrix24