Create ticket via REST API with a content


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”,

I tried with the key “Text” and “Content”, but nothing works.

Thanks for your help.


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);

Hope this helps,

-Rob McNicholas
UC Berkeley


@Robert_McNicholas From your code you’re using REST 1.0, @hannii33 is referring to REST 2.0

I’m facing exactly the same problem, the initial Content is not saved upon Ticket creation with REST 2.0.

You can see examples on ticket create for REST2 here:

The key, in this case, is Content.

1 Like

It doesn’t work for me, I ended up creating a comment with the initial content.

The examples also show that you can reference custom fields by name and that doesn’t work either


I’ve just finished off support for using names with CustomFields, please try again.

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: