A new comment can be added to an existing issue simply by sending Ketura an HTTP POST request containing the details of the comment.
Python 2 example of adding a comment to an existing issue
The following example is a Python script that will send a request to a local Ketura server to add a comment to an existing issue with id I1001.
This example uses the free httplib2 library, which is not included as standard in most Python distributions. The httplib2 library can be download from the httplib2 website
, which also has installation instructions
.
#!/usr/bin/python2.5
# createIssueCommentExample.py
# Araxis Ketura API Script Example.
# Copyright (c) 2009 Araxis Ltd. All rights reserved.
#
# Redistribution and use of this example code, with or without modification, are hereby permitted.
# import required classes from modules
from httplib2 import Http
from urllib import urlencode
# start HTTP client
client = Http()
# add user name and password credentials
client.add_credentials('es', 'pw')
# declare information to be used on request
url = "http://localhost:9453/Ketura/API/Issues/1001/Comments"
headers = {'Content-type': 'application/x-www-form-urlencoded; charset=UTF-8'}
data = {'CommentText' : 'Please tell customer as soon as this is complete'}
# send request
(resp_headers, content) = client.request(url, "POST", body=urlencode(data), headers=headers)
Reference
| Resource path | /Issues/{id}/Comments |
|---|---|
| Accepted HTTP methods | OPTIONS*, POST |
* Sending an OPTIONS request will generate a response containing a WADL
document. This document describes the services available from this resource path.
POST summary
| HTTP method | POST |
|---|---|
| Request representation media type | application/x-www-form-urlencoded |
| Request representation format | HTML form-encoded key-value pairs |
| Successful response code | 204 |
| Authentication method | Basic HTTP Authentication |
POST data
| Name | Description | Required | Can Be Empty | Maximum Length (Characters) |
|---|---|---|---|---|
| CommentText | Text of the comment. | yes | yes | 15728640 |
POST response
| Response Code(s) | Significant Response Headers | Response Representation | Response Representation MIME Type |
|---|---|---|---|
| 204 | None | None | n/a |
| 401, 500 and greater | None | Text containing java stack trace | text/plain |
| Others | None | HTML error page | text/html |
