Scroll down @ OTRS Admin Documentation : Here you find the curl statement for search ticket operations.
curl "http://localhost/otrs/nph-genericinterface.pl/Webservice/GenericTicketConnectorREST/Ticket?UserLogin=agent&Password=123&Queue=Postmaster"
Does someone knows how to search for 2 different queues in one curl statement? Yes I can do 2 curl requests, but if it is possible one single request would be better.
I tried some URL query param array stuff, but nothing works, e.g.
//just second Queue is used!!!
curl "http://localhost/otrs/nph-genericinterface.pl/Webservice/GenericTicketConnectorREST/Ticket?UserLogin=agent&Password=123&Queue=Postmaster&Queue=Postmaster2"
//
curl "http://localhost/otrs/nph-genericinterface.pl/Webservice/GenericTicketConnectorREST/Ticket?UserLogin=agent&Password=123&Queue[]=Postmaster&Queue[]=Postmaster2"
//
curl "http://localhost/otrs/nph-genericinterface.pl/Webservice/GenericTicketConnectorREST/Ticket?UserLogin=agent&Password=123&Queue=Postmaster,Postmaster2"
//
curl "http://localhost/otrs/nph-genericinterface.pl/Webservice/GenericTicketConnectorREST/Ticket?UserLogin=agent&Password=123&Queue=[Postmaster,Postmaster2]"
I'm not sure it's possible using a GET method if I look briefly at the OTRS sources. But there is a way to supply a parameter more than once if you switch the TicketSearch operation to POST and supply the query parameters via JSON.
Configuring the web service is relatively easy; in OTRS you should navigate to Admin > Web Services. Select the 'Rest" web service. Choose the 'Configure' button next to the network transport ('HTTP::REST').
Now update the route mapping for TicketSearch from Ticket
to something unique, for example TicketSearch
. Otherwise, POST requests to the Ticket
route will end up in the TicketCreate operation. See the screenshot below:
Now you can pass the parameters as a JSON document. The curl
example looks like this:
curl -X POST --data '{"Queues": ["Bar", "Foo"]}' \
"http://localhost/otrs/nph-genericinterface.pl/Webservice/GenericTicketConnectorREST/TicketSearch?UserLogin=test&Password=test"
Please note that if one of your queue names does not exist, the search will return no tickets.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With