This might have been asked before but I couldn’t find any post yet. I want to filter freshservice tickets by custom field. I can set the filter in the web portal but I can’t find how to do it with the api.
For instance we have a custom dropdown called category. Here is the command I am using.
I have a custom text fied and the api works fine on that:
curl -v -uapikeym:test -X GET 'httpdomainom/api/v2/tickets/filter?query=%22custom_dropdown:%27First%20Choice%27%20OR%20custom_checkbox:true%22
curl -v -u BFmRPLonNvh4pGHTKMVe:X -X GET ‘https://fs-proxy.spimageworks.com/api/v2/tickets/filter?query=“show:ngp”’
This give me invalid field error. But if I change the query to priority it works fine. I also trying this from the docs
it’s not working for custom combobox. If the field is a string field then it works fine. Also, what’s First Choice here? is it supposed to be the value or actual positon of the choice?
First Choice is one of the dropdown values for the custom field DD Sample. For the above one, I have tried to filter ticket which has the value of First Choice for the DD Sample custom field.
I have two custom fields below are the details
The custom field name DD Sample is of type dropdown and it has two values First Choice and Second Choice.
The custom field name DD Check is of type checkbox.
Now I am trying to filter the ticket which has the value of First Choice for the custom field name DD Sample and DD Check is another custom field of type checkbox and it needs to be checked. You can find below the curl request. It works for me Please check from your side and let us know.
curl -v -u APIKey:X -X GET 'https://YourDomain.freshservice.com/api/v2/tickets/filter?query="dd_cat_below:%27First%20Choice%27%20AND%20dd_check:true"'
If you still face the error please share your original curl request ( hide API key and domain ) not from doc to find the issue.
Thank you for the reply. I got the admin access to check the dropdown types. You are right when I create a new dropdown the query works fine.
Upon further investigation I realised the fields I want to query are the dependent fields. Appologies I should have checked the field type first. It’s nested as
category->sub-category->item.
Can you help with how to query it? I tried looking at the doc and it doesn’t have anything specific for dependent fields.
I created a new field and I can’t query that either.
As per the freshservice api documentation supported custom fields type that we can able to filter the ticket via API are listed below, only the custom fields that have the below types can be used in the query param I guess and I don’t see a way to filter tickets using custom field with type dependent.