Search for tickets using REST2 POST

I’m having trouble using GET for some search queries. I’m wondering if it has to do with the length of the query, although it is well under the 2,000 byte URL limit. I would like to try testing with POST, but am finding no documentation on it other than

POST /tickets
    search for tickets with the 'query' and optional 'simple' parameters

I’m unable to even get any query to work. Does this use JSON, like creating a ticket does, or does it maybe use form data? What is the format of the data?

Here is the application/json data that I have tried:

{“query”:“Queue = ‘Alarms’”}

Here is the URL I’m using for my POST:


This search works fine with GET (unencoded):

http://localhost/rt/REST/2.0/tickets?query=Queue = ‘Alarms’

Any help would be appreciated.

I have learned that when you POST a search in REST2, it doesn’t use JSON. Instead, you need to use a content of application/x-www-form-urlencoded. This is unlike a POST to create, which uses application/json content.

You should also be wary of using GET for searches. I have many details, but I was getting search hits that shouldn’t have matched. It was odd, in that the order of the AND clauses made a difference. POST seems to work much better (with the right content type).