Creating tasks
This endpoint creates a new task.
HTTP Request
POST https://api.lunatask.app/v1/tasks
Body Parameters
Parameter | Description |
---|---|
area_id | The Area ID of the list where the task should be created (UUID, can be found in our apps in the area settings) |
goal_id | The ID of the goal where the task should be created (optional, can be found in our apps in the goal's settings) |
name | The name of the task (optional, but impractical if empty) |
note | The note attached to task (optional, formatted in Markdown) |
status | The status of the task (optional, see possible values) |
motivation | The motivation value of the task (optional, see possible values) |
eisenhower | The quadrant on Eisenhower matrix (optional, see possible values) |
estimate | The estimate of the task (optional, in minutes) |
priority | Priority of the task (optional, see possible values) |
scheduled_on | ISO-8601 formatted date the task is scheduled on (optional) |
completed_at | ISO-8601 formatted time when the task was completed (optional) |
source | Identification of external system where the task is coming from (optional, e.g. "github" ) |
source_id | The ID of the record in the external system (optional, e.g. "123" ) |
source
/source_id
attributes are useful for later lookup of previously created tasks when updating without a need to remember task IDs. The API does not enforce uniqueness of source
/source_id
.
When creating a task, given there's already an existing not completed task in the same area with the same source
/source_id
, the endpoint will return 204 No Content
without creating a duplicate.
Example in Ruby
require 'rest-client'
access_token = 'xxx'
payload = {
name: 'My task',
area_id: '11b37775-5a34-41bb-b109-f0e5a6084799',
source: 'github',
source_id: '123'
}
RestClient.post('https://api.lunatask.app/v1/tasks', payload.to_json, { Authorization: "bearer #{access_token}", "Content-Type": 'application/json' })
Response
The above command returns JSON structured like this:
{
"task": {
"id": "066b5835-184f-4fd9-be60-7d735aa94708",
"area_id": "11b37775-5a34-41bb-b109-f0e5a6084799",
"goal_id": null,
"status": "later",
"previous_status": null,
"estimate": null,
"priority": 0,
"progress": null,
"motivation": "unknown",
"eisenhower": 0,
"sources": [
{
"source": "github",
"source_id": "123"
}
],
"scheduled_on": null,
"completed_at": null,
"created_at": "2021-01-10T10:39:25Z",
"updated_at": "2021-01-10T10:39:25Z",
}
}