Znuny & OTRS REST API – Search for DynamicField Content

Learn in this article how to use REST API of OTRS & Znuny to search for Tickets with specific DynamicField_NameXY content.

In the previous article Access Znuny & OTRS API via REST, we guide you thru the essential configuration steps of REST API in the role of the service provider. If you followed the steps your system is now accessible via new REST API Routes and is providing data in response to REST API requests. The default configuration of the TicketSearch route does not allow you to leverage the full power of the REST API.

Modification of the Default REST API Configuration

The default configuration of the REST API TicketSearch interface is expecting GET method at the following URL

http://{{znunyHostName}}/otrs/nph-genericinterface.pl/Webservice/{{webservice name}}/Ticket

The GET method allows you to specify simple request options, which does not allow you to leverage from all search capabilities deployed in TicketSearch method as documented in OTRS 6.0 API Reference Perl > Perl Modules > Kernel::GenericInterface::Operation::Ticket::TicketSearch.

The fix is simple, open the webservice Network Transport configuration:


and change two options:

  1. Rename the TicketSearch route
  2. Change the expected method from GET to GET and POST

Searching for Tickets with DynamicField_NameXYZ = something

Now we can use search OTRS & Znuny using REST API leveraging from all search filters documented in OTRS 6.0 API Reference Perl > Perl Modules > Kernel::GenericInterface::Operation::Ticket::TicketSearch.

The following cURL example will search for all Tickets which have DynamicField_IsRedmineLinked value like ‘Yes*’ where asteriks is a wildcard.

curl --location --request POST 'http://localhost/otrs/nph-genericinterface.pl/Webservice/Ticket REST API/TicketSearch?SessionID=8HdMDh9iBc1fpBXqq53JCPzVLQIhIpC0&AllArticles=1&DynamicFields=1' \
--header 'Content-Type: application/json' \
--data-raw '{
   "DynamicField_IsRedmineLinked":{
       "Like":"Yes*"
   }
}'

Related articles

Access Znuny & OTRS API via REST
Authenticate to Znuny / OTRS REST API
Examples Calling REST API of Znuny & OTRS with cURL

Do you need help with Znuny / OTRS?​

Do you require experts with real expertise since 2006 on Znuny and OTRS?
Do you require help on solving your issues?

We have experts who can help you on:
– giving you hands-on support
– implementing  custom solutions inside your OTRS/Znuny
– Integration existing Solutions into your Znuny
– Integrating artificial intelligence into your Znuny7OTRS and proce3sses

Get in touch with us and we will check if and how we can help you.​

Leave a Reply