REST 2.0 Content Creation

Since I am new to RT, it seems like I might be just a little bit early in adopting the new REST2 API.

I am able to create tickets, but don’t know how to create the initial content. Does anyone know what tag to use for this? Or, are these supposed to be entered as comments. I’m fine with that, but am also not sure how to create a comment. The documentation says I need to POST to a certain URL, but doesn’t mention the content at all. I assume I need to use JSON, but have no clue what key to use.

POST /ticket/:id/correspond
POST /ticket/:id/comment
    add a reply or comment to the ticket

Any help would be most appreciated.

I’d suggest that you manually create a comment/reply on the ticket, query it through the API, this will give you the data-structure which you can use moving forward to post this through the API.

Thanks for the reply. That is sound advice, but that type of thinking is what got me up to this point.

When I create a ticket from the web interface, I can get history for that ticket. That gets me to a transaction, which then gets me to an attachment of type text/html. I can see all of the raw headers and there is also a Content key that shows my initial text.

The exact same thing happens when I add a comment via the RT web page.

I don’t know how to translate this into a POST request via the REST 2.0 API. I was expecting all of my payloads to be JSON encoded, but maybe I need to post a comment as HTML. I’ll give that a try. However, if that’s the case, does the API not allow to add an initial description when the ticket is created (with JSON)? That just doesn’t seem right, but I don’t know what key to use.

I’ll post any progress I make, but I’m hoping that someone already has the answers to these seemingly basic questions about initial content and adding comments.

Here is a pastebin of the output that I am getting: