Skip to main content

Tasks Costs API

General notes

Content

Tasks collection:

Single role:

Tasks collection

Tasks Costs Index

This method needs permission access on tasks.

Request

Index behaviourDefinition
Paginated by defaultNo
Sortingid, name, value, currency_id, is_transport, delivery_date, task_id
Filtersid: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 create on tasks.

Request

ParamTypeDescriptionRequirements
namestringExtra cost nameRequired. Must be a string.
valuefloatPrice/DistanceRequired. Must be an unsigned float.
currency_idstringCurrency identifierRequired if is_transport is false.
is_transportboolDetermines whether record is price or distance.Required.
delivery_datedateDelivery dateRequired 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 read on tasks.

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 delete on tasks.

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 update on tasks.

Method for updating TasksCost data.

Request

ParamTypeDescriptionRequirements
namestringExtra cost nameMust be a string.
valuefloatPrice/DistanceMust be an unsigned float.
currency_idstringCurrency identifierRequired if is_transport is false.
is_transportboolDetermines whether record is price or distance.
delivery_datedateDelivery dateRequired 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."
}
]
}