最近の検索
最近の検索はありません
Search API for custom records using "contains"
投稿日時:2022年3月28日
Hi,
I have an API call to the search endpoint of the custom objects API (https://developer.zendesk.com/api-reference/custom-data/custom-objects-api/search/). I want to return records using a "like" sentence and my understanding from documentation is that you must use "contains" for that (https://developer.zendesk.com/api-reference/custom-data/custom-objects-api/search/#comparison-object). But in my case, it works as "eq". Example: The field to search is an string that can contains numbers so I want to return all records that have a number 2 in that string (e.g. AB2, 2AB...). If I use "$contains": "2", it returns no records. If I use "$contains": "AB2" or "$contains": "2AB", it returns one record.
Is that the expected behavior? If so, is there any way to get records back using a "like" instruction in a field that just contains one string?
Thanks.
Regards,
Lydia
0
4件のコメント
Erica Girges
Thank you for clarifying and following up. Appreciate you sharing your findings and providing that documentation link. Glad you were able to get that clarity!
Best,
Erica
0
Lydia C
Update: That's the intended behavior as explained here: https://developer.zendesk.com/documentation/custom-data/custom-objects/searching-object-records/#building-a-basic-query
0
Lydia C
Hi Erica,
The field that I'm using for querying is a string so if I remove the quotes I get an error:
Regards,
Lydia
0
Erica Girges
Have you tried searching for 2 without the quotes? I believe that when you place the query value in quotes it treats it as a phrase search instead of a prefix search. It ends up looking for a phrase where the full value is 2 instead of just part of it.
Hope this helps!
Best,
Erica
0
サインインしてコメントを残します。