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?
We have lot of experiences with OTRS and Znuny and can help you with your issues. Get in touch with us and we will check if and how we can help you.

Leave a Comment

Do you need help with Znuny / OTRS?​

We have lot of experiences with OTRS and Znuny.
We can help you with your issues to solve them.

From giving you support up to implementing integrations to your existing systems.

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

Get OTRS/Znuny/OTOBO Support
Step 1 of 2
To get a quick and efficient clearance of your needs, our experts will call you.
We communicate in English.
Maybe we can communicate in your native language too. So please let us know your native written and spoken language.

Your environment

We have different partners for different tasks and company sizes.
To assign you the right partner and thus the proper system engineers, we would like to ask you for more details about your environment.
The more details we get the quicker we can narrow down to the right persons.