Files
invoiceninja/openapi/paths/tasks.yaml
2025-10-10 12:12:20 +11:00

600 lines
19 KiB
YAML

/api/v1/tasks:
get:
tags:
- tasks
summary: "List tasks"
description: "Lists tasks, search and filters allow fine grained lists to be generated.\n *\n * Query parameters can be added to performed more fine grained filtering of the tasks, these are handled by the TaskFilters class which defines the methods available"
operationId: getTasks
x-codeSamples:
- lang: php
label: php
source: |
$ninja = new InvoiceNinja("YOUR-TOKEN");
$tasks = $ninja->tasks->all([
'per_page' => 10,
'page' => 1,
'client_id' => 'D2J234DFA'
]);
- lang: curl
label: curl
source: |
curl -X GET https://demo.invoiceninja.com/api/v1/tasks \
-H "X-API-TOKEN: YOUR-TOKEN" \
-H "X-Requested-With: XMLHttpRequest"
parameters:
- $ref: "#/components/parameters/X-API-TOKEN"
- $ref: "#/components/parameters/X-Requested-With"
- $ref: "#/components/parameters/include"
- $ref: "#/components/parameters/index"
- $ref: "#/components/parameters/per_page_meta"
- $ref: "#/components/parameters/page_meta"
responses:
200:
description: "A list of tasks"
headers:
X-MINIMUM-CLIENT-VERSION:
$ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
X-RateLimit-Remaining:
$ref: "#/components/headers/X-RateLimit-Remaining"
X-RateLimit-Limit:
$ref: "#/components/headers/X-RateLimit-Limit"
content:
application/json:
schema:
type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/Task'
meta:
type: object
$ref: '#/components/schemas/Meta'
401:
$ref: "#/components/responses/401"
403:
$ref: "#/components/responses/403"
422:
$ref: '#/components/responses/422'
429:
$ref: '#/components/responses/429'
5XX:
description: 'Server error'
default:
$ref: "#/components/responses/default"
post:
tags:
- tasks
summary: "Create task"
description: "Adds an task to a company"
operationId: storeTask
parameters:
- $ref: "#/components/parameters/X-API-TOKEN"
- $ref: "#/components/parameters/X-Requested-With"
- $ref: "#/components/parameters/include"
requestBody:
description: Task object that needs to be added to the company
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/TaskRequest'
x-codeSamples:
- lang: php
label: php
source: |
$ninja = new InvoiceNinja("YOUR-TOKEN");
$task = $ninja->tasks->create([
'description' => 'Complete project documentation',
'client_id' => 'D2J234DFA',
'project_id' => 'P2J234DFA',
'time_log' => '2.5',
'status_id' => 1,
'due_date' => '2024-01-31',
'priority' => 1
]);
- lang: curl
label: curl
source: |
curl -X POST https://demo.invoiceninja.com/api/v1/tasks \
-H "X-API-TOKEN: YOUR-TOKEN" \
-H "Content-Type: application/json" \
-H "X-Requested-With: XMLHttpRequest" \
-d '{
"description": "Complete project documentation",
"client_id": "D2J234DFA",
"project_id": "P2J234DFA",
"time_log": "2.5",
"status_id": 1,
"due_date": "2024-01-31",
"priority": 1
}'
responses:
200:
description: "Returns the saved task object"
headers:
X-MINIMUM-CLIENT-VERSION:
$ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
X-RateLimit-Remaining:
$ref: "#/components/headers/X-RateLimit-Remaining"
X-RateLimit-Limit:
$ref: "#/components/headers/X-RateLimit-Limit"
content:
application/json:
schema:
$ref: "#/components/schemas/Task"
401:
$ref: "#/components/responses/401"
403:
$ref: "#/components/responses/403"
422:
$ref: '#/components/responses/422'
429:
$ref: '#/components/responses/429'
5XX:
description: 'Server error'
default:
$ref: "#/components/responses/default"
"/api/v1/tasks/{id}":
get:
tags:
- tasks
summary: "Show task"
description: "Displays a task by id"
operationId: showTask
x-codeSamples:
- lang: php
label: php
source: |
$ninja = new InvoiceNinja("YOUR-TOKEN");
$task = $ninja->tasks->show("D2J234DFA");
- lang: curl
label: curl
source: |
curl -X GET https://demo.invoiceninja.com/api/v1/tasks/D2J234DFA \
-H "X-API-TOKEN: YOUR-TOKEN" \
-H "X-Requested-With: XMLHttpRequest"
parameters:
- $ref: "#/components/parameters/X-API-TOKEN"
- $ref: "#/components/parameters/X-Requested-With"
- $ref: "#/components/parameters/include"
- name: id
in: path
description: "The Task Hashed ID"
required: true
schema:
type: string
format: string
example: D2J234DFA
responses:
200:
description: "Returns the task object"
headers:
X-MINIMUM-CLIENT-VERSION:
$ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
X-RateLimit-Remaining:
$ref: "#/components/headers/X-RateLimit-Remaining"
X-RateLimit-Limit:
$ref: "#/components/headers/X-RateLimit-Limit"
content:
application/json:
schema:
$ref: "#/components/schemas/Task"
401:
$ref: "#/components/responses/401"
403:
$ref: "#/components/responses/403"
422:
$ref: '#/components/responses/422'
429:
$ref: '#/components/responses/429'
5XX:
description: 'Server error'
default:
$ref: "#/components/responses/default"
put:
tags:
- tasks
summary: "Update task"
description: "Handles the updating of a task by id"
operationId: updateTask
parameters:
- $ref: "#/components/parameters/X-API-TOKEN"
- $ref: "#/components/parameters/X-Requested-With"
- $ref: "#/components/parameters/include"
- name: id
in: path
description: "The task Hashed ID"
required: true
schema:
type: string
format: string
example: D2J234DFA
requestBody:
description: Task object that needs to be updated
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/TaskRequest'
x-codeSamples:
- lang: php
label: php
source: |
$ninja = new InvoiceNinja("YOUR-TOKEN");
$task = $ninja->tasks->update("D2J234DFA", [
'description' => 'Updated task description',
'time_log' => '3.5',
'status_id' => 2,
'due_date' => '2024-02-15'
]);
- lang: curl
label: curl
source: |
curl -X PUT https://demo.invoiceninja.com/api/v1/tasks/D2J234DFA \
-H "X-API-TOKEN: YOUR-TOKEN" \
-H "Content-Type: application/json" \
-H "X-Requested-With: XMLHttpRequest" \
-d '{
"description": "Updated task description",
"time_log": "3.5",
"status_id": 2,
"due_date": "2024-02-15"
}'
responses:
200:
description: "Returns the task object"
headers:
X-MINIMUM-CLIENT-VERSION:
$ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
X-RateLimit-Remaining:
$ref: "#/components/headers/X-RateLimit-Remaining"
X-RateLimit-Limit:
$ref: "#/components/headers/X-RateLimit-Limit"
content:
application/json:
schema:
$ref: "#/components/schemas/Task"
401:
$ref: "#/components/responses/401"
403:
$ref: "#/components/responses/403"
422:
$ref: '#/components/responses/422'
429:
$ref: '#/components/responses/429'
5XX:
description: 'Server error'
default:
$ref: "#/components/responses/default"
delete:
tags:
- tasks
summary: "Delete task"
description: "Handles the deletion of a task by id"
operationId: deleteTask
x-codeSamples:
- lang: php
label: php
source: |
$ninja = new InvoiceNinja("YOUR-TOKEN");
$ninja->tasks->delete("D2J234DFA");
- lang: curl
label: curl
source: |
curl -X DELETE https://demo.invoiceninja.com/api/v1/tasks/D2J234DFA \
-H "X-API-TOKEN: YOUR-TOKEN" \
-H "X-Requested-With: XMLHttpRequest"
parameters:
- $ref: "#/components/parameters/X-API-TOKEN"
- $ref: "#/components/parameters/X-Requested-With"
- $ref: "#/components/parameters/include"
- name: id
in: path
description: "The Task Hashed ID"
required: true
schema:
type: string
format: string
example: D2J234DFA
responses:
200:
description: "Returns a HTTP status"
headers:
X-MINIMUM-CLIENT-VERSION:
$ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
X-RateLimit-Remaining:
$ref: "#/components/headers/X-RateLimit-Remaining"
X-RateLimit-Limit:
$ref: "#/components/headers/X-RateLimit-Limit"
401:
$ref: "#/components/responses/401"
403:
$ref: "#/components/responses/403"
422:
$ref: '#/components/responses/422'
429:
$ref: '#/components/responses/429'
5XX:
description: 'Server error'
default:
$ref: "#/components/responses/default"
"/api/v1/tasks/{id}/edit":
get:
tags:
- tasks
summary: "Edit task"
description: "Displays a task by id"
operationId: editTask
x-codeSamples:
- lang: php
label: php
source: |
$ninja = new InvoiceNinja("YOUR-TOKEN");
$task = $ninja->tasks->show("D2J234DFA");
- lang: curl
label: curl
source: |
curl -X GET https://demo.invoiceninja.com/api/v1/tasks/D2J234DFA/edit \
-H "X-API-TOKEN: YOUR-TOKEN" \
-H "X-Requested-With: XMLHttpRequest"
parameters:
- $ref: "#/components/parameters/X-API-TOKEN"
- $ref: "#/components/parameters/X-Requested-With"
- $ref: "#/components/parameters/include"
- name: id
in: path
description: "The Task Hashed ID"
required: true
schema:
type: string
format: string
example: D2J234DFA
responses:
200:
description: "Returns the client object"
headers:
X-MINIMUM-CLIENT-VERSION:
$ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
X-RateLimit-Remaining:
$ref: "#/components/headers/X-RateLimit-Remaining"
X-RateLimit-Limit:
$ref: "#/components/headers/X-RateLimit-Limit"
content:
application/json:
schema:
$ref: "#/components/schemas/Task"
401:
$ref: "#/components/responses/401"
403:
$ref: "#/components/responses/403"
422:
$ref: '#/components/responses/422'
429:
$ref: '#/components/responses/429'
5XX:
description: 'Server error'
default:
$ref: "#/components/responses/default"
/api/v1/tasks/create:
get:
tags:
- tasks
summary: "Blank task"
description: "Returns a blank task with default values"
operationId: getTasksCreate
x-codeSamples:
- lang: php
label: php
source: |
$ninja = new InvoiceNinja("YOUR-TOKEN");
$task = $ninja->tasks->model();
- lang: curl
label: curl
source: |
curl -X GET https://demo.invoiceninja.com/api/v1/tasks/create \
-H "X-API-TOKEN: YOUR-TOKEN" \
-H "X-Requested-With: XMLHttpRequest"
parameters:
- $ref: "#/components/parameters/X-API-TOKEN"
- $ref: "#/components/parameters/X-Requested-With"
- $ref: "#/components/parameters/include"
responses:
200:
description: "A blank task object"
headers:
X-MINIMUM-CLIENT-VERSION:
$ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
X-RateLimit-Remaining:
$ref: "#/components/headers/X-RateLimit-Remaining"
X-RateLimit-Limit:
$ref: "#/components/headers/X-RateLimit-Limit"
content:
application/json:
schema:
$ref: "#/components/schemas/Task"
401:
$ref: "#/components/responses/401"
403:
$ref: "#/components/responses/403"
422:
$ref: '#/components/responses/422'
429:
$ref: '#/components/responses/429'
5XX:
description: 'Server error'
default:
$ref: "#/components/responses/default"
/api/v1/tasks/bulk:
post:
tags:
- tasks
summary: "Bulk task actions"
description: ""
operationId: bulkTasks
parameters:
- $ref: "#/components/parameters/X-API-TOKEN"
- $ref: "#/components/parameters/X-Requested-With"
- $ref: "#/components/parameters/index"
requestBody:
description: "User credentials"
required: true
content:
application/json:
schema:
type: array
items:
description: "Array of hashed IDs to be bulk 'actioned"
type: integer
example: "[0,1,2,3]"
responses:
200:
description: "The Task User response"
headers:
X-MINIMUM-CLIENT-VERSION:
$ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
X-RateLimit-Remaining:
$ref: "#/components/headers/X-RateLimit-Remaining"
X-RateLimit-Limit:
$ref: "#/components/headers/X-RateLimit-Limit"
content:
application/json:
schema:
$ref: "#/components/schemas/Task"
401:
$ref: "#/components/responses/401"
403:
$ref: "#/components/responses/403"
422:
$ref: '#/components/responses/422'
429:
$ref: '#/components/responses/429'
5XX:
description: 'Server error'
default:
$ref: "#/components/responses/default"
"/api/v1/tasks/{id}/upload":
post:
tags:
- tasks
summary: "Uploads a task document"
description: "Handles the uploading of a document to a task"
operationId: uploadTask
parameters:
- $ref: "#/components/parameters/X-API-TOKEN"
- $ref: "#/components/parameters/X-Requested-With"
- $ref: "#/components/parameters/include"
- name: id
in: path
description: "The Task Hashed ID"
required: true
schema:
type: string
format: string
example: D2J234DFA
requestBody:
description: "File Upload Body"
required: true
content:
multipart/form-data:
schema:
type: object
properties:
_method:
type: string
example: PUT
documents:
type: array
items:
description: "Array of binary documents for upload"
type: string
format: binary
responses:
200:
description: "Returns the Task object"
headers:
X-MINIMUM-CLIENT-VERSION:
$ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
X-RateLimit-Remaining:
$ref: "#/components/headers/X-RateLimit-Remaining"
X-RateLimit-Limit:
$ref: "#/components/headers/X-RateLimit-Limit"
content:
application/json:
schema:
$ref: "#/components/schemas/Task"
401:
$ref: "#/components/responses/401"
403:
$ref: "#/components/responses/403"
422:
$ref: '#/components/responses/422'
429:
$ref: '#/components/responses/429'
5XX:
description: 'Server error'
default:
$ref: "#/components/responses/default"
/api/v1/tasks/sort:
post:
tags:
- tasks
summary: "Sort tasks on KanBan"
description: "Sorts tasks after drag and drop on the KanBan."
operationId: sortTasks
parameters:
- $ref: "#/components/parameters/X-API-TOKEN"
- $ref: "#/components/parameters/X-Requested-With"
- $ref: "#/components/parameters/include"
requestBody:
description: Task sort order data
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/TaskSortRequest'
x-codeSamples:
- lang: php
label: php
source: |
$ninja = new InvoiceNinja("YOUR-TOKEN");
$ninja->tasks->sort([
'task_ids' => ['D2J234DFA', 'E3K345EFB', 'F4L456FGC'],
'status_id' => 1,
'sort_order' => ['F4L456FGC', 'D2J234DFA', 'E3K345EFB']
]);
- lang: curl
label: curl
source: |
curl -X POST https://demo.invoiceninja.com/api/v1/tasks/sort \
-H "X-API-TOKEN: YOUR-TOKEN" \
-H "Content-Type: application/json" \
-H "X-Requested-With: XMLHttpRequest" \
-d '{
"task_ids": ["D2J234DFA", "E3K345EFB", "F4L456FGC"],
"status_id": 1,
"sort_order": ["F4L456FGC", "D2J234DFA", "E3K345EFB"]
}'
responses:
200:
description: "Returns an Ok, 200 HTTP status"
headers:
X-MINIMUM-CLIENT-VERSION:
$ref: "#/components/headers/X-MINIMUM-CLIENT-VERSION"
X-RateLimit-Remaining:
$ref: "#/components/headers/X-RateLimit-Remaining"
X-RateLimit-Limit:
$ref: "#/components/headers/X-RateLimit-Limit"
401:
$ref: "#/components/responses/401"
403:
$ref: "#/components/responses/403"
422:
$ref: '#/components/responses/422'
429:
$ref: '#/components/responses/429'
5XX:
description: 'Server error'
default:
$ref: "#/components/responses/default"