Create/Import a Task

A new task can be added to an existing issue simply by sending Ketura an HTTP POST request containing the details of the task to be added.

Python 2 example of adding a task to an existing issue

The following example is a Python script that will send a request to a local Ketura server to add a task to an existing issue with id I1001. The new task will be placed at the end of the issue’s task order.

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
# createIssueTaskExample.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/Tasks"
headers = {'Content-type': 'application/x-www-form-urlencoded; charset=UTF-8'}
data = {'UserId' : 'fred',
        'Summary' : 'Translate quickstart guide in Spanish',
        'Work' : '3 d',
        'Description' : 'Translate the quickstart guide text but leave copyright messages in English.'}

# send request
(resp_headers, content) = client.request(url, "POST", body=urlencode(data), headers=headers)

[Download This Example | Download Complete Example]

Reference

Resource path /Issues/{id}/Tasks
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 media type application/x-www-form-urlencoded
Request format HTML form-encoded key-value pairs
Successful response code 201
Authentication method Basic HTTP Authentication

POST data

Name Description Required Can Be Empty Maximum Length (Characters)
UserId The id of the Ketura user to which the new task will be assigned, or empty if the task is to remain unassigned. Value is case-sensitive. yes yes 32
Summary A short description of the task yes no 255
Work The estimated amount of work to complete the task. The format of this value is a integer and a time abbreviation, separated by a space; e.g. 5 h. Time abbrivations are defined in the Ketura system settings. yes no n/a
Description The details of the task yes yes 15728640

POST response

Response Code(s) Significant Response Headers Response Response MIME Type
201 Location, contains the URI with new task id. e.g. http://localhost:9453/Ketura/API/Issues/1001/Tasks/2001 for a new task that has been given id T2001. None n/a
401, 500 and greater None Text containing java stack trace text/plain
Others None HTML error page text/html