rest-api
rest-api copied to clipboard
Dynamic filter doesn't work on number
If a custom field has type=Number it seems it's not possible to search for it with a dynamic filter.
Testcase:
- Create a new custom field for a company, named "testingdf" and set type=Number
- Go to a company and set testingdf=12345
- Do a dynamic-filter REST call with filterJson={"rules":[{"LHS":"testingdf","CONDITION":"EQUALS","RHS":"12345"}],"contact_type":"COMPANY"}'
- An empty array [] will be returned, with status code 200 (according to the document 204 should have been returned for a no match).
- Update the custom filed and set type=TextField
- Do the same dynamic-filter call, still just an empty array as response
- Update the company and set testingdf to something else, then change it back to 12345 (if the field isn't updated to something else first it won't work).
- Now do that dynamic-filter call again and the company will be returned.
- If you switch back to type=Number and update the field for the selected company it'll stop working again.
Calling with filterJson={"rules":[{"LHS":"testingdf","CONDITION":"EQUALS","RHS":12345}],"contact_type":"COMPANY"}' , aka with a number as RHS does not change anything.
Full dynamic-filter call:
curl https://something.agilecrm.com/dev/api/filters/filter/dynamic-filter -H "Accept: application/json" \ -H "Content-Type :application/x-www-form-urlencoded" \ -d 'page_size=25&global_sort_key=-created_time&filterJson={"rules":[{"LHS":"testingdf","CONDITION":"EQUALS","RHS":"12345"}],"contact_type":"COMPANY"}' \ -v -u user@something:key -X POST
I just bumped into this same problem. How has this not been addresses almost 4 years later?!
I want to get some contact data filtered by a custom field.
While trying to call the API via CURL (eg. as described in the documentation https://github.com/agilecrm/rest-api#devapifiltersfilterdynamic-filter-1) the command returns the following error message:
The command "filterJson" is either misspelled or could not be found.