Show time entries
GET /time_entries.xml
Returns all time entries for all users, sorted in reverse chronological order (date_at). A user of role time tracker can only access his own time entries.
Response : 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<time-entries type="array">
<time-entry>
...
</time-entry>
<time-entry>
...
</time-entry>
</time_entries>
The returned list can be filtered by the following parameters:
- customer_id
- ID of the customer
- project_id
- ID of the project
- service_id
- ID of the service
- user_id
- ID of the user
- billable
- true or false
- note
- Search within the notes of time entries
- at
- today, yesterday, this_week, last_week, this_month, last_month or dates formatted YYYY-MM-DD
- from, to
- both formatted YYYY-MM-DD
- locked
- true or false
Example:
GET /time_entries.xml?service_id=3
Returns all time entries featuring service ID 3.
To return all time entries featuring the service with the ID 3 or with the ID 4, just use a comma-separated list:
GET /time_entries.xml?service_id=3,4
The same is possible with customer_id, project_id and user_id.
Furthermore, it is possible to group time entries & to access them with the bookmarks created over the web UI.
Show all time entries for a specific date
GET /daily.xml
Lists today's time entries for the user in question.
GET /daily/2009/2/7.xml
Lists all time entries on February 7th for the user in question.
Show a single time entry
GET /time_entries/{id}.xml
Returns a single time entry. This time entry can belong to any user of the account, as long as the current user is not a time tracker.
Response : 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<time-entry>
<id type="integer">71</id>
<date-at type="date">2008-04-16</date-at>
<minutes type="integer">0</minutes>
<revenue type="float" nil="true"></revenue>
<billable type="boolean">true</billable>
<note></note>
<user-id type="integer">2</user-id>
<user-name>Freddy Freelancer</user-name>
<project-id type="integer">3</project-id>
<project-name>API 2.0</project-name>
<service-id type="integer">12</service-id>
<service-name>Documentation</service-name>
<customer-id type="integer">13</customer-id>
<customer-name>King</customer-name>
<locked type="boolean">false</locked>
<created-at type="datetime">2008-09-18T01:26:18+02:00</created-at>
<updated-at type="datetime">2008-09-18T01:26:18+02:00</updated-at>
</time-entry>
If the timer is running on this exact time entry, some more information will be returned: since when the timer is ticking and how many minutes have been measured in total (measured time + existing minutes).
Response : 200 OK
<?xml version="1.0" encoding="UTF-8"?>
<time-entry>
...
<tracking>
<since type="datetime">2008-01-22T22:58:13+01:00</since>
<minutes type="integer">12</minutes>
</tracking>
</time-entry>
Create a new entry
POST /time_entries.xml
Creates a new time entry. All parameters are optional. You can specify the following parameters:
- date-at
- Date of the time entry, formatted YYY-MM-DD. Default: today
- minutes
- Default: 0
- note
- Default: '' (empty string)
- user_id
- This can only be set by administrators or the account owner. Default: ID of the current user
- project_id
- Default: nil
- service_id
- Default: nil
- locked
- This can only be set by administrators or the account owner. Default: false
IMPORTANT: A locked time entry can not be updated or deleted. Administrators or the account owner can force an update or destruction by passing an force parameter – for example to unlock the entry.
Request Body
<time-entry>
<date-at>2009-2-12</date-at>
<minutes>185</minutes>
<note></note>
<service-id>2</service-id>
<project-id>3</project-id>
</time-entry>
Response : 201 Created
<?xml version="1.0" encoding="UTF-8"?>
<time-entry>
<id type="integer">5</id>
<date-at type="date">2009-2-12</date-at>
<minutes type="integer">185</minutes>
<revenue type="float" nil="true"></revenue>
<billable type="boolean">true</billable>
<note></note>
<user-id type="integer">2</user-id>
<user-name>Freddy Freelancer</user-name>
<project-id type="integer">3</project-id>
<project-name>API 2.0</project-name>
<service-id type="integer">2</service-id>
<service-name>Documentation</service-name>
<customer-id type="integer">13</customer-id>
<customer-name>King</customer-name>
<locked type="boolean">false</locked>
<created-at type="datetime">2009-02-11T18:54:45+01:00</created-at>
<updated-at type="datetime">2009-02-11T18:54:45+01:00</updated-at>
</time-entry>
Edit
PUT /time_entries/{id}.xml
Updates the time entry with the given parameters. The time entry can belong to any user of the account, as long as the current user is a administrator or the account owner. You can specify the same parameters you use when creating a time entry.
Request Body
<time-entry>
<minutes>120</minutes>
<service-id>3</service-id>
</time-entry>
Response : 200 OK
Delete
DELETE /time_entries/{id}.xml
Deletes a time entry.
