Getting data on time and finanсial costs through API: get_costs
Sample get_costs request
https://your—domain.com/api/admin/v2/?action=get_costs&hash=HASH
Returns data on entered time and financial costs for tasks and subtasks
If page parameter is not specified, costs for all account projects will be received
Optional parameters:
- page — returns costs of the specified project/task/subtask (see link format for details)
- datestart and dateend — date range for searching data in DD.MM.YYYY format (inclusive)
- is_timer — returns only those cost lines, where time is:
1 — received from the timer
0 — entered manually
- filter — additional parameter for searching (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):
- task=TASK_ID — returns data of a specific task/subtask by its ID (can be obtained through get_all_tasks or get_tasks method) (Integer)
- project=PROJECT_ID — returns data on tasks of a specific project by its ID (can be obtained through get_projects method) (Integer)
- comment — user comment to a separate cost line (String)
- dateadd or date_added — date the costs were added in the 'DD.MM. YYYY' format
Returned data on cost lines:
- id — cost line unique identifier
- comment — user comment to a separate cost line
- time — time cost value
- money — financial cost value
- date — the date the costs were added
- is_timer — the way of adding time costs
- user_from — information about the user, who added an individual cost line
- task — dataset on a task/subtask, where costs are added (see get_task method for details on returned parameters meaning)
- total — separate total values for time and financial costs received in the response
true — received from the timer
false — entered manually
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"
}
}
Was this article helpful?
Yes, thank you!
No