OTRS Generic Interface (Search Ticket) - Array for the request url

Scroll down @ OTRS admin documentation : here you will find the curl instruction for search ticket operations.

curl "http://localhost/otrs/nph-genericinterface.pl/Webservice/GenericTicketConnectorREST/Ticket?UserLogin=agent&Password=123&Queue=Postmaster"

      

Does anyone know how to search for two different queues in the same curl statement? Yes, I can make 2 requests for curls, but if possible, one request would be better.

I've tried some elements of the url request parameters array but nothing works, eg.

//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]"

      

+3


source to share


1 answer


I'm not sure if this is possible using the GET method if I briefly describe the OTRS sources. But there is a way to provide the parameter more than once if you switch the TicketSearch operation to POST and supply the request parameters via JSON.

Setting up a web service is relatively straightforward; in OTRS you should go to Admin> Web Services. Select the Recreation web service. Select the "Configure" button next to the network transport ("HTTP :: REST").

Now update the route mapping for TicketSearch from Ticket

to something unique like TicketSearch

. Otherwise, POST requests to the route Ticket

will end in a TicketCreate operation. See screenshot below:

enter image description here



Now you can pass parameters as JSON document. An example curl

looks like this:

curl -X POST --data '{"Queues": ["Bar", "Foo"]}' \
"http://localhost/otrs/nph-genericinterface.pl/Webservice/GenericTicketConnectorREST/TicketSearch?UserLogin=test&Password=test"

      

Note that if one of your queue names does not exist, the search will not return any tickets.

+6


source







All Articles