Search query with multiple condition
AnsweredHi
I am developing an Zendesk app that requires to fetch the ticket data with multiple conditions using API call
1. <baseurl>/api/v2/search.json?query=784068495 (This will return all the tickets that contains the value 784068495)
I would like to add additional condition to search all the matching tickets
2. <baseurl>/api/v2/search.json?query=SunnyDayAND784068495 (This should return all the tickets that contains the values 'SunnyDay' AND '784068495'
Please let me know if this is possible, if not suggest alternate way of fetching the data.
Thanks
-
Sudarshan
The API search should work like advanced search in support. So you can create the AND condition:
/api/v2/search.json?query=type:ticket+784068495%20sunnyday
-
Hello Sudarshan,
Keep in mind that the response of the Search API will change on the 15th of October.
https://develop.zendesk.com/hc/en-us/articles/360022563994--BREAKING-New-Search-API-Result-Limits
You will get 1000 results on a single page instead of 100 per page. So you can't paginate the results.
With kind regards,
Sebastiaan
Sparkly ⭐ -
Sebastiaan
That is a great catch. I am going to have to give that some thought. Thank you.
-
How do I get the details with OR condition example given below.
<baseurl>/api/v2/search.json?query=SunnyDayOR784068495 (This should return all the tickets that contains the values 'SunnyDay' OR '784068495'
-
Hello Ravi,
As far as I know, there's no OR operator.
Just this:
If submitting multiple search terms, search has a default AND behavior, rather than an OR behavior. For example, searching for the following phrase returns results only if all of the words are present, in any order.Please upgrade my account
However, when you use a data property keyword multiple times in a query, there is an OR search across the values you specified. The following phrase returns results that contain either the tag "silver" or the tag "bronze".
tags:silver tags:bronze
Source: https://support.zendesk.com/hc/en-us/articles/203663226-Zendesk-Support-search-reference
With kind regards,
Sebastiaan
Sparkly ⭐
Please sign in to leave a comment.
5 Comments