Search custom attributes via API

Dear community

I’m using ticket custom fields and I’m looking for a way to search via API all tickets that have a specific value in a custom field.

For example, the custom field name is alarmkey and I’m using the following API GET call

https://X.X.X.X/api/v1/tickets/search?alarmkey=IF_DOWN_0x00008391_35

Is it the correct method of searching custom field values via API?

I would appreciate your support

Thank you

Hi @Manuel
The search via API works exactly the same as via the UI. See this help page for examples. Especially the AND and OR options might be useful.

https://user-docs.zammad.org/en/latest/advanced/search.html

Your API request will be:

GET https://www.my-zammad.com/api/v1/tickets/search?query=alarmkey: %20IF_DOWN_0x00008391_35

The URL parameter is as follows:

query=[object]: [value]
You need to url-encode your query. So the space becomes %20. : will work but you can also use %3A. Or just use https://www.urlencoder.org/

Cheers,
Gijs

1 Like

Thank you. It works.

1 Like

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.