Filtering contacts via API

Hi,

I am trying to filter contacts while accessing them via API. I tried the following requests:

https://[CRM-URL]/api/v8/modules/Contacts?filter[Contacts.some_custom_field_c]=[eq]1
https://[CRM-URL]/api/v8/modules/Contacts?filter[Contacts.some_custom_field_c]=1

Both give me blank JSON (no message whatsoever), which - in my interpretation - means that no record could be found. However, I checked in the database and there is one record with the flag. The request itself works because then I remove the filter the records get extracted.

Any idea on this issue is highly appreciated. :slight_smile:

Best,
Peter

Do you have XDEBUG and an IDE set up? You could try debugging through the API code. That’s the bright side of having a fully open-source system.

I’m sorry that I don’t have simpler answer to your question, I don’t have experience using the API…

I don’t think I am able to go through the SuiteCRM code. I am not developer enough for that. :slight_smile:

Ok, no problem.

Start by trying double brackets around the “eq” operator, that’s how the examples are in the Docs.


https://[CRM-URL]/api/v8/modules/Contacts?filter[Contacts.some_custom_field_c]=[[eq]]1

If that doesn’t work, have a look in your logs at the time of the failed search.

suitecrm.log
php_errors.log (or whatever your web server log is called)

Did the double brackets around the “eq” operator work?

@pgr and @l.horstink: Thanks for the hint, the double brackets work. I don’t know how I could miss it - it is all over the documentation.