I use the REST API 2.0 and try to create a ticket with a text.
I create a ticket with the POST method and a JSON content, but I don’t understand which key I have to use to add a text.
For example, today my JSON content seems like :
{
“Queue”:“My Queue”,
“Subject”:“Subject of the ticket”,
“Status”:“new”
}
I tried with the key “Text” and “Content”, but nothing works.
The key is ‘Text’. Here’s a snippet of PHP code I use. The variable $msg contains the body. Note the comment I’m including about continuation lines needing to begin with spaces.
/* RT content with newlines must have spaces at beginning of
subsequent lines */
$rtcontent['Text'] = preg_replace("/\n/", "\n ", $msg);
$rtresponse = $rt->createTicket($rtcontent);
With Content, you are correct it doesn’t work in the released versions of the REST2 API. There is a feature branch where support was added. I’ve just added a unit test to confirm that it works as expected. Check out: