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.
curl -v -u apiKey -X GET 'https://domain/api/v2/tickets?query=“category:‘Pipeline’”
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
Can you please let me know what I am missing?curl -v -u BFmRPLonNvh4pGHTKMVe:X -X GET ‘https://fs-proxy.spimageworks.com/api/v2/tickets?query=“category:Pipeline”’
curl -v -u firstname.lastname@example.org:test -X GET 'https://domain.freshservice.com/api/v2/tickets/filter?query=“custom_dropdown:‘First%20Choice’%20OR%20custom_checkbox:true”
If we try to filter based on the custom field name it is working. and below is the curl request for that please check that.
Custom Field Name:
curl -v -u APIKey:X -X GET 'https://yourDomain.freshservice.com/api/v2/tickets/filter?query="dd_sample:%27First%20Choice%27"'
let us know if it works.
I can’t get it to work
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?
what’s the First Choice here?
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
- 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
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.
Please let me know when you can.
Sure, I will check and keep you posted. Meanwhile If possible can you please send me the screenshot of the custom field which you want to query?
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
You can find more information on Freshservice API Document