Menu
SuiteCRM dedicated support by SalesAgility
Welcome, Guest
Username: Password: Remember me

TOPIC: Filtering contacts via API

Filtering contacts via API 4 months 4 hours ago #69314

  • pl@langheinrichco.de
  • pl@langheinrichco.de's Avatar
  • Offline
  • Junior Member
  • Posts: 20
  • Karma: 0
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. :-)

Best,
Peter
The administrator has disabled public write access.

Filtering contacts via API 4 months 47 minutes ago #69318

  • pgr
  • pgr's Avatar
  • Offline
  • Administrator
  • Posts: 8197
  • Thank you received: 1263
  • Karma: 296
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...

My SuiteCRM In-depth blog.
Thank you for always stating your SuiteCRM version, checking your logs, reading the Docs, and searching before you ask!
The administrator has disabled public write access.

Filtering contacts via API 3 months 4 weeks ago #69328

  • pl@langheinrichco.de
  • pl@langheinrichco.de's Avatar
  • Offline
  • Junior Member
  • Posts: 20
  • Karma: 0
I don't think I am able to go through the SuiteCRM code. I am not developer enough for that. :-)
The administrator has disabled public write access.

Filtering contacts via API 3 months 4 weeks ago #69351

  • pgr
  • pgr's Avatar
  • Offline
  • Administrator
  • Posts: 8197
  • Thank you received: 1263
  • Karma: 296
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)

My SuiteCRM In-depth blog.
Thank you for always stating your SuiteCRM version, checking your logs, reading the Docs, and searching before you ask!
The administrator has disabled public write access.

Filtering contacts via API 3 months 3 weeks ago #69482

  • l.horstink
  • l.horstink's Avatar
  • Offline
  • Administrator
  • Head of Marketing
  • Posts: 32
  • Thank you received: 9
  • Karma: 1
Did the double brackets around the "eq" operator work?
The administrator has disabled public write access.

Filtering contacts via API 3 months 3 weeks ago #69560

  • pl@langheinrichco.de
  • pl@langheinrichco.de's Avatar
  • Offline
  • Junior Member
  • Posts: 20
  • Karma: 0
@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.
The administrator has disabled public write access.
Time to create page: 0.065 seconds
Powered by Kunena Forum