Query from command line not working (Wrong query, expecting a VALUE)


very newby with the command line capabilities.

I am trying to follow examples from here https://rt-wiki.bestpractical.com/wiki/REST#Ticket_Search
Searching for ID seems to work, with a command like this:

wget --post-data 'user=me&pass=xxxx' https://a.RT.server/REST/1.0/search/ticket?query=id=12345

However, searching for all tickets in a queue, with a command like this

wget --post-data 'user=me&pass=xxxx' https://a.RT.server/REST/1.0/search/ticket?query=Queue=Support

gives me an error:

Invalid query: 'Wrong query, expecting a VALUE in 'Queue=>Support<--here' at /opt/rt3/sbin/../lib/RT/Tickets.pm line 3036.

The queue “Support” exists. That is not the problem. What am I missing?

Thanks a lot in advance.

You most likely need to quote the queue name ‘Support’ you can test your queries in the RT web UI using the query builder interface!

There is also the rt-crontool that you may be interested in.

Lastly if you’re interested in installing an extension there is the REST2 extension that is more modern:

Thanks for the prompt response. I tried both, single and double quotes, still the same result.
I will check that rt-crontool.

Try this instead:

wget --post-data 'user=me&pass=xxxx' 'https://a.RT.server/REST/1.0/search/ticket?query=Queue="Support"'

yeah, that works. I should have guessed it myself :slight_smile:
Thanks a lot !!