HTTP Verb: POST

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

Object: Comment

Location: available

Formats: XML, JSON

Create a comment and return the list of merge request version comments in requested format among with their location in a Location: \_location header.

Params

To create a merge request version 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.

Examples:

XML

<content>Great code</content>

JSON

{"content":"Great code"}

Query string

content=Great code

Examples

For example purposes we use a JSON body

{"content":"Great code"}

Request XML, using cURL utility:

curl -i -H "Authorization: Bearer _token" -H "Content-type: application/json" -d '{"content":"Great code"}' https://api.assembla.com/v1/spaces/_space_id/space_tools/_space_tool_id/merge_requests/_merge_request_id/versions/_version/comments.xml

Response

HTTP/1.1 201 Created
Server: nginx/0.8.55
Date: Thu, 19 Jul 2012 13:27:13 GMT
Content-Type: application/xml; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Status: 201
Location: https://api.assembla.com/v1/spaces/_space_id/space_tools/_space_tool_id/merge_requests/_merge_request_id/versions/_version/comments
...

<?xml version="1.0" encoding="UTF-8"?>
<comments type="array">
  <comment>
    <id type="integer">1448453</id>
    <content>Great code</content>
    <space-id>b6nRoCPC0r2Oq0aaeP0Qfc</space-id>
    <user-id>azc2fw0uWr4zsKacwqjQXA</user-id>
    <merge-request-id type="integer">2077053</merge-request-id>
    <created-at type="dateTime">2012-06-22T11:19:40Z</created-at>
    <updated-at type="dateTime">2012-06-22T11:19:40Z</updated-at>
  </comment>
  <comment>
    <id type="integer">1448523</id>
    <content>@skolotinskiy please check new version.</content>
    <space-id>b6nRoCPC0r2Oq0aaeP0Qfc</space-id>
    <user-id>cBtTkkPDir2O7YaaeP0Qfc</user-id>
    <merge-request-id type="integer">2077053</merge-request-id>
    <created-at type="dateTime">2012-06-22T11:31:55Z</created-at>
    <updated-at type="dateTime">2012-06-22T11:31:55Z</updated-at>
  </comment>
</comments>

Request JSON, using cURL utility:

curl -i -H "Authorization: Bearer _token" -H "Content-type: application/json" -d '{"content":"Great code"}' https://api.assembla.com/v1/spaces/_space_id/space_tools/_space_tool_id/merge_requests/_merge_request_id/versions/_version/comments.json

Response

HTTP/1.1 201 Created
Server: nginx/0.8.55
Date: Thu, 19 Jul 2012 13:38:12 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Status: 201
Location: https://api.assembla.com/v1/spaces/_space_id/space_tools/_space_tool_id/merge_requests/_merge_request_id/versions/_version/comments
...

[{"id":1448453,
  "content":"Great code",
  "space_id":"b6nRoCPC0r2Oq0aaeP0Qfc",
  "user_id":"azc2fw0uWr4zsKacwqjQXA",
  "merge_request_id":2077053,
  "created_at":"2012-06-22T11:19:40.000Z",
  "updated_at":"2012-06-22T11:19:40.000Z"},
 {"id":1448523,
  "content":"@skolotinskiy please check new version.",
  "space_id":"b6nRoCPC0r2Oq0aaeP0Qfc",
  "user_id":"cBtTkkPDir2O7YaaeP0Qfc",
  "merge_request_id":2077053,
  "created_at":"2012-06-22T11:31:55.000Z",
  "updated_at":"2012-06-22T11:31:55.000Z"}
]

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 comments are located.

Description for each field: Comment object fields reference