• FAQ
  • API
  • Costs
  • Getting time and finanсial costs of tasks through API: get_costs

Getting time and finanсial costs of tasks through API: get_costs


Sample get_costs request

?action=get_costs
Returns individual costs added for selected or all tasks

Optional parameters:
  • id_project — project ID (costs of all tasks of a particular project)
  • id_task — task ID (costs of a particular task)
  • datestart and dateend — searching data range in DD.MM.YYYY format (inclusive)
  • is_timer — time costs type, possible values:
    1 — received from the timer
    0 — entered manually
  • filter — additional searching parameter (see search_tasks for a list of operators to work with data used in filter)

Possible data for use in filter (for the get_costs method):
  • id=TASK_ID — costs of a particular task (Integer field)
  • project=PROJECT_ID — costs on tasks of a particular project (Integer field)
  • comment — user comment to a separate cost line (String field)
  • dateadd — date, when the costs were added in the 'DD.MM. YYYY' format (String field)

Returned data:
  • id — cost line ID
  • comment — user comment to a separate cost line
  • time — time cost value
  • money — financial cost value
  • date — date, when the costs were added
  • is_timer — time costs type
  • true — received from the timer
    false — entered manually
    • user_from — user, who added an individual cost line
    • task — task, where costs are added (see get_task method for details on returned parameters meaning)
    • total — total time and financial costs of all cost lines

Sample JSON response
If the request succeeds, the response will contain ok status and the following data:

{
    "status": "ok",
    "data": [
        {
            "id": "COSTS_ID_1",
            "comment": "COSTS_COMMENT",
            "time": "10:00",
            "money": "100.00",
            "date": "YYYY—MM—DD",
            "is_timer": false,
            "user_from": { "id": "USER_ID",
                "email": "USER_EMAIL",
                "name": "USER_NAME"
            },
            "task": {
                "id": "TASK_ID",
                "name": "TASK_NAME",
                "page": "/project/PROJECT_ID/TASK_ID/",
                "status": "active",
                "priority": "0..10",
                "user_from": { "id": "USER_ID",
                    "email": "USER_EMAIL",
                    "name": "USER_NAME"
                },
                "user_to": { "id": "USER_ID",
                    "email": "USER_EMAIL",
                    "name": "USER_NAME"
                },             "project": {                 "id": "PROJECT_ID",                 "name": "PROJECT_NAME",                 "page": "/project/PROJECT_ID/"             }, 
                "date_added": "YYYY—MM—DD HH:II", "date_start": "YYYY—MM—DD",
                "date_end": "YYYY—MM—DD", "time_end": "HH:II",
                "max_time": 20,
                "max_money": 500, "tags": { "TAG_ID": "TAG_NAME_1", "TAG_ID": "TAG_NAME_2", }
            },
   
        },
        {
            "id": "COSTS_ID_2",
            "comment": "COMMENT_COSTS",
... ... ... }
    ],
    "total": {
        "time": "HH:II",
        "money": "10.01"
    }
}