HTTP Verb: POST

Available statuses: 201 Created, 404 Not Found, 422 Unprocessable Entity

Object: TicketComment

Location: available

Formats: XML, JSON

Create a component and return newly created component body and location.

Params

To create a ticket comment, a data body must be provided. Data can be provided in three formats: XML, JSON and query string. To specify data type of XML or JSON add the Content-type: application/(json|xml) header to request headers, if you want to provide query string simply skip the Content-type header.

All params should be sent in ticket_comment namespace, e.g.:

XML

<ticket_comment>
  <comment>Comment text</comment>
  ...
</ticket_comment>

JSON

{"ticket_comment":{"comment":"Comment text",...}}

Query string

ticket_comment[comment]=Comment text&...

Check the full list of fields on ticket comment object fields reference page

Examples

For example purposes we use a JSON body

{"ticket_comment":{"comment":"comment body"}}

Request XML, using cURL utility:

curl -i -H "Authorization: Bearer _token" -H "Content-type: application/json" -d '{"ticket_comment":{"comment":"comment body"}}' https://api.assembla.com/v1/spaces/_space_id/tickets/_ticket_number/ticket_comments.xml

Response

HTTP/1.1 201 Created
Server: nginx/0.8.55
Date: Wed, 18 Jul 2012 12:14:59 GMT
Content-Type: application/xml; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Status: 201
Location: http://api.assembla.com/v1/spaces/_space_id/tickets/_ticket_number/ticket_comments/_id
...

<?xml version="1.0" encoding="UTF-8"?>
<ticket-comment>
  <updated-at type="datetime">2012-07-18T12:14:59Z</updated-at>
  <user-id nil="true"></user-id>
  <created-on type="datetime">2012-07-18T12:14:59Z</created-on>
  <ticket-changes nil="true"></ticket-changes>
  <ticket-id type="integer">1</ticket-id>
  <id type="integer">215</id>
  <comment>comment body</comment>
</ticket-comment>

Request JSON, using cURL utility:

curl -i -H "Authorization: Bearer _token" -H "Content-type: application/json" -d '{"ticket_comment":{"comment":"comment body"}}' http://api.assembla.com/v1/spaces/_space_id/tickets/_ticket_number/ticket_comments.json

Response

HTTP/1.1 201 Created
Server: nginx/0.8.55
Date: Wed, 18 Jul 2012 12:16:01 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Status: 201
Location: http://api.assembla.com/v1/spaces/_space_id/tickets/_ticket_number/ticket_comments/_id
...

{
  "ticket_changes":null,
  "id":216,
  "created_on":"2012-07-18T12:16:01Z",
  "ticket_id":1,
  "comment":"comment body",
  "updated_at":"2012-07-18T12:16:01Z",
  "user_id":null
}

JSON is formatted here for readability, in a real response JSON body is inline with no indentation.

Note: pay attention to Location header, this is the URL where newly created resource is located, you can GET on this URL to access this resource.

Description for each field: ticket comments object fields reference page