Working with Time and Expenses
The commands listed in this chapter can be used for managing tracked Time and Expenses.
About Time & Expenses #
The following fields are available for Time records:
- user_id (integer) - The ID of the user whose time is logged.
- record_user (text) - The User (name and e-mail) whose time is logged.
- value (float) - The number of hours logged. Two formats are allowed: 5:30 (five hours and 30 minutes) and 5.5. (five hours and a half). The value of this field is required when a time record is added.
- job_type_id (integer) - The ID of the job type.
- summary (text) - The description.
- record_date (date) - The date when the time was logged. A value for this field is required when a time record is added.
- billable_status (integer) - The time entry status (not billable, billable pending payment, paid).
The following expense fields are available:
- category_id (integer) - The ID of the Expense Category.
- user_id (integer) - The ID of the user whose expenses are logged.
- value (float) - The value of the logged expenses.
- summary (text) - The description.
- record_date (date) - The date when the expense was logged.
- billable_status (integer) - The expense status.
The time or expense billable_status API response can have one of the four possible values:
- 0 - not billable
- 1 - billable
- 2 - pending payment
- 3 - paid
Additional resources used by time and expense records can be found in the article Object state related commands.
projects/:project_id/tracking #
This command will display the last 300 time and expense records in a project.
There is a way to do that - make sure that you have included the dont_limit_result GET variable and set it to 1.
Method: GET
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
<tracking_objects> <tracking_object> <id>2</id> <class> <![CDATA[TimeRecord]]> </class> ... </tracking_object> <tracking_object> <id>3</id> <class> <![CDATA[Expense]]> </class> ... </tracking_object> </tracking_objects>
projects/:project_id/tracking/time/add #
This command adds a new Time record to the time log in the chosen project.
Method: POST
Request example:
1 2 3 4 5
time_record[value]=2:30 time_record[user_id]=1 time_record[record_date]=2012-07-18 time_record[job_type_id]=1 submitted=submitted
Response:
1 2 3 4 5 6
<time_record> <id>5</id> ... <value>2.5</value> ... </time_record>
projects/:project_id/tasks/:task_id/tracking/time/add #
This command adds a new Time record to a specific Task in the chosen project.
Method: POST
Request example:
1 2 3 4 5
time_record[value]=2:30 time_record[user_id]=1 time_record[record_date]=2012-07-18 time_record[job_type_id]=1 submitted=submitted
Response:
1 2 3 4 5 6
<time_record> <id>5</id> ... <value>2.5</value> ... </time_record>
projects/:project_id/tracking/time/:record_id #
This command displays the Time record details.
Method: GET
Example response:
1 2 3 4
<time_record> <id>4</id> ... </time_record>
projects/:project_id/tracking/time/:record_id/edit #
This command updates the time record properties.
Method: POST
Request example:
1 2
time_record[value]=2:30 submitted=submitted
Response:
1 2 3 4 5 6
<time_record> <id>5</id> ... <value>2.5</value> ... </time_record>
projects/:project_id/tracking/expenses/add #
This command adds a new expense record to the Expense log in the chosen project.
Method: POST
Request example:
1 2 3 4
expense[value]=200 expense[user_id]=1 expense[record_date]=2012-07-19 submitted=submitted
Response:
1 2 3 4 5 6
<expense> <id>3</id> ... <value>200</value> ... </expense>
projects/:project_id/tracking/expenses/:record_id #
This command displays expense record details.
Method: GET
Example response:
1 2 3 4
<expense> <id>4</id> ... </expense>
projects/:project_id/tracking/expenses/:record_id/edit #
This command updates the expense record properties.
Method: POST
Request example:
1 2
expense[value]=250 submitted=submitted
Response:
1 2 3 4 5 6
<expense> <id>3</id> ... <value>250</value> ... </expense>