POST /v1/tasks
HTTP Verb: POST
Available statuses: 201 Created, 404 Not Found, 422 Unprocessable Entity
Object: Task
Location: available
Formats: XML, JSON
Create a task.
Params
To create a task, 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 the user-task root node (XML) or user_task namespace (JSON, query string), e.g.:
XML
<?xml version="1.0" encoding="UTF-8"?>
<user-task>
<space-id>b3gNxoscyr4Q7K5bfBjDYC</space-id>
<description>Description goes here</description>
...
</user-task>
JSON
{"user_task":{"space_id":"b3gNxoscyr4Q7K5bfBjDYC","description":"Description goes here",...}}
Query string
user_task[space_id]=b3gNxoscyr4Q7K5bfBjDYC&user_task[description]=Description goes here...
Check the full list of available params on Task object fields reference
Examples
For example purposes, we use a JSON body
{"user_task":{"space_id":"b3gNxoscyr4Q7K5bfBjDYC","contents":"Description goes here"}}
Request XML, using cURL utility:
curl -i -H "Authorization: Bearer _token" -H "Content-type: application/json" -d '{"user_task":{"space_id":"b3gNxoscyr4Q7K5bfBjDYC","contents":"Description goes here"}}' https://api.assembla.com/v1/tasks.xml
Response:
HTTP/1.1 201 Created
Server: nginx/0.8.55
Date: Fri, 07 Sep 2012 13:08:42 GMT
Content-Type: application/xml; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Status: 201
Location: https://api.assembla.com/v1/tasks/26
...
<?xml version="1.0" encoding="UTF-8"?>
<user-task>
<billed type="boolean">false</billed>
<space-id>b3gNxoscyr4Q7K5bfBjDYC</space-id>
<ticket-number nil="true"></ticket-number>
<created-at type="datetime">2013-01-01T13:23:36Z</created-at>
<description>Description goes here</description>
<url nil="true"></url>
<begin-at type="datetime">2012-12-17T08:51:00Z</begin-at>
<updated-at type="datetime">2013-01-01T13:23:36Z</updated-at>
<id type="integer">26</id>
<hours type="decimal">1.0</hours>
<end-at type="datetime">2012-12-17T08:51:00Z</end-at>
<ticket-id nil="true"></ticket-id>
<user-id>b9DhI-spar4OJk5bfBjDYC</user-id>
<job-agreement-id nil="true"></job-agreement-id>
</user-task>
Request JSON, using cURL utility:
curl -i -H "Authorization: Bearer _token" -H "Content-type: application/json" -d '{"user_task":{"space_id":"b3gNxoscyr4Q7K5bfBjDYC","description":"Description goes here"}}' https://api.assembla.com/v1/tasks.json
Response:
HTTP/1.1 201 Created
Server: nginx/0.8.55
Date: Fri, 07 Sep 2012 13:12:30 GMT
Content-Type: application/json; charset=utf-8
Transfer-Encoding: chunked
Connection: keep-alive
Status: 201
Location: https://api.assembla.com/v1/tasks/26
...
{
"billed": false,
"created_at": "2012-12-17T08:52:20Z",
"ticket_number": null,
"space_id": "b3gNxoscyr4Q7K5bfBjDYC",
"begin_at": "2012-12-17T08:51:00Z",
"url": null,
"description": "Description goes here",
"updated_at": "2012-12-17T08:52:20Z",
"job_agreement_id": null,
"user_id": "apr9bascyr4Q7K5bfBjDYC",
"ticket_id": null,
"end_at": "2012-12-17T08:51:00Z",
"hours": "1.0",
"id": 7
}
JSON is formatted here for readability, in a real response JSON body is inline with no indentation.
Description for each field: Task object fields reference