Tasks Costs API
General notes
Content
Tasks collection:
Single role:
Tasks collection
Tasks Costs Index
This method needs permission
accessontasks.
Request
| Index behaviour | Definition |
|---|---|
| Paginated by default | No |
| Sorting | id, name, value, currency_id, is_transport, delivery_date, task_id |
| Filters | id:enum, name:string, value:float, is_transport:bool, delivery_date:date, task_id:int |
| Embedded | - |
GET /api/v0/tasks{taskId}/costs HTTP/1.1
Content-Type: application/json
Response
200 OK
GET /api/v0/tasks{task_id}/costs HTTP/1.1
Content-Type: application/json
{
"items": [
{
"id": 12,
"name": "Grafická práce",
"value": 5400,
"currency_id": "CZK",
"is_transport": false,
"delivery_date": "null",
"task_id": 130
},
{
"id": 13,
"name": "Doprava k zákazníkovi",
"value": 480,
"currency_id": "CZK",
"is_transport": true,
"delivery_date": "2023-05-04T22:00:00.000000Z",
"task_id": 130
},
]
}
Create Tasks Costs
This method needs permission
createontasks.
Request
| Param | Type | Description | Requirements |
|---|---|---|---|
name | string | Extra cost name | Required. Must be a string. |
value | float | Price/Distance | Required. Must be an unsigned float. |
currency_id | string | Currency identifier | Required if is_transport is false. |
is_transport | bool | Determines whether record is price or distance. | Required. |
delivery_date | date | Delivery date | Required if is_transport is true. |
POST /api/v0/tasks{taskId}/costs HTTP/1.1
Content-Type: application/json
{
"name": "Grafická práce #2",
"value": 300,
"currency_id": "EUR",
"is_transport": false
}
Response
200 OK
POST /api/v0/tasks{task_id}/costs HTTP/1.1
Content-Type: application/json
{
"id": 30,
"name": "Grafická práce #2",
"value": 3000,
"currency_id": "EUR",
"is_transport": false,
"delivery_date": null,
"task_id": 5320
}
Single tasks cost
Tasks cost detail
GET /api/v0/tasks/{task_id}/costs/{task_costs_id}
This method needs permission
readontasks.
Get TasksCost detail.
Request
GET /api/v0/tasks/1/costs/1 HTTP/1.1
Content-Type: application/json
Response
200 OK
GET /api/v0/tasks/1/costs/1 HTTP/1.1
Content-Type: application/json
{
"id": 1,
"name": "Grafická práce",
"value": 36000,
"currency_id": "CZK",
"is_transport": true,
"delivery_date": "2023-05-03T22:00:00.000000Z",
"task_id": 130
}
404 NOT FOUND
TasksCost was not found.
GET /api/v0/tasks/2 HTTP/1.1
Content-Type: application/json
Status-Code: 404
{
"type": "NotFound",
"message": "Required model was not found.",
"id": "0cd85449-05fe-4866-9802-8192e6785fc7"
}
Delete Tasks Cost
DELETE /api/v0/tasks/{task_id}/costs/{tasks_cost_id}
This method needs permission
deleteontasks.
Get users work time on TasksCost detail.
Request
DELETE /api/v0/tasks/1/costs/1 HTTP/1.1
Content-Type: application/json
Response
204 No Content
DELETE /api/v0/tasks/1/costs/1 HTTP/1.1
Content-Type: application/json
404 NOT FOUND
Task was not found.
DELETE /api/v0/tasks/1/costs/1 HTTP/1.1
Content-Type: application/json
Status-Code: 404
{
"type": "NotFound",
"message": "Required model was not found.",
"id": "0cd85449-05fe-4866-9802-8192e6785fc7"
}
Update Tasks Cost
PUT/PATCH /api/v0/tasks/{task_id}/costs/{task_cost_id}
This method needs permission
updateontasks.
Method for updating TasksCost data.
Request
| Param | Type | Description | Requirements |
|---|---|---|---|
name | string | Extra cost name | Must be a string. |
value | float | Price/Distance | Must be an unsigned float. |
currency_id | string | Currency identifier | Required if is_transport is false. |
is_transport | bool | Determines whether record is price or distance. | |
delivery_date | date | Delivery date | Required if is_transport is true. |
For PATCH method any field can be omitted.
PATCH /api/v0/tasks/1/costs/1 HTTP/1.1
Content-Type: application/json
{
"name": "Nové wireframes",
"value": 700,
"currency_id": "CZK"
}
Response
200 OK
Task successfully updated.
PATCH /api/v0/tasks/1/costs/1 HTTP/1.1
Content-Type: application/json
{
"id": 1,
"name": "Nové wireframes",
"value": 700,
"currency_id": "CZK",
"is_transport": false,
"delivery_date": null,
"task_id": 5320
}
404 NOT FOUND
Task was not found.
PATCH /api/v0/tasks/1/costs/1 HTTP/1.1
Content-Type: application/json
Status-Code: 404
{
"type": "NotFound",
"message": "Required model was not found.",
"id": "0cd85449-05fe-4866-9802-8192e6785fc7"
}
422 UNPROCESSABLE ENTITY
Validation error occurred.
PATCH /api/v0/tasks/1/costs/1 HTTP/1.1
Content-Type: application/json
{
"type" : "ValidationError",
"message" : "The given data was invalid.",
"id" : "fe1b04de-b347-43b5-8118-864c1eefaccf",
"errors": [
{
"field": "currency_id",
"message": "The currency_id field is required."
}
]
}