Entries REST API
- /entries GET
- /entries POST
- /entries/new GET
- /entries/search POST
- /entries/search GET
- /entries/:id GET
- /entries/:id PUT
- /entries/:id DELETE
- /entries/:id/edit GET
- /entries/:id/lock POST
- /entries/:id/unlock POST
- /entries/:id/start POST
- /entries/:id/stop POST
/entries GET
Returns a list of entries for the default ‘context’ of a new session in Tempo. The basic gist here is that the entries you’ll get back from calling GET on /entries will just be for the last week, and just for the current user. Results are paginated.
Beta Change
This method will now provide only the listing of entries for the current user, ordered by
occurred_on DESC, created_at DESC. These are entries created by the user, or entries assigned to the user.This method had previously provided the entries visible in the default ‘context’, which is now the default result set seen on the reports screen (the default report), see GET /reports.
Parameters
- per_page
Number of entries per page, defaults to 10.
- page
Offset of paginated entries, defaults to 1.
- id[]
-
This parameter allows you to request specific entries by ID. Repeat parameter once for each ID, like so:
/entries/?id[]=1&id[]=2&id[]=3
/entries POST
Enables you to create a new time or timer entry.
If you want to create a new entry, you might supply a piece of XML like this:
<entry> <hours>5.0</hours> <notes>client meeting in NYC to discuss project requirements</notes> <project-id>4096</project-id> <tag-s>meetings discovery</tag-s> </entry>
By using our text-entry syntax this would get even simpler:
<entry> <command>client meetings in NYC to discuss project requirements #project_name @meetings @discovery</command> </entry>
Not all fields may be updated directly; these are:
:created_at, :creator_id, :id, :is_locked, :is_timing, :source, :updated_at
Parameters
- command
A text-entry command, over-rides other parameters. Syntax described here.
- user-id
-
Integer ID describing the user to whom the entry is attributed.
User must be a member of the specified project.
- hours
-
The number of hours worked. Can be in the following formats:
1.5, 5, 2h, 45m, 2:30Leaving the hours blank, or not supplying, will cause the entry to start up as a timer.
- is-locked
Defaults to false.
- is-timing
Defaults to false.
- notes
Text description field.
- project-id
Integer ID describing the project to which the entry is attributed.
- timer-sessions
Text field describing when timer was started and stopped, delimited by a ‘;’
- tag-s
Text field listing tag names for this entry, delimited by white space or commas.
/entries/new GET
Simply produces an XML document providing default values for a new entry for the current user. Not required for creating an entry, but probably instructive, and helpful in that it provides some defaults you may wish to use.
/entries/search POST
Beta – Removed/Redirected
Due to many understandable complaints, we’re changing this to HTTP GET, and redirecting the request to /reports/search. GET requests will be redirected, POST requests will be ignored, and eventually this method will be removed.
When requesting a set of entries from Tempo via search, you must provide a Context XML document. This is basically a set of parameters telling Tempo which entries you want. It allows you to specify which users to look at, projects, tags, and the date range. Here’s a full example of the options:
<?xml version="1.0" encoding="UTF-8"?>
<context>
<interval>last7days</interval>
<start-date>2008-01-01</start-date>
<end-date>2008-06-01</end-date>
<project-ids type="array">
<project-id type="integer">1024</project-id>
<project-id type="integer">2048</project-id>
<project-id type="integer">8192</project-id>
</project-ids>
<user-ids type="array">
<user-id type="integer">1024</user-id>
<user-id type="integer">2048</user-id>
</user-ids>
<tags type="array">
<tag>tempo</tag>
<tag>support</tag>
</tags>
<exclude-tags type="array">
<exclude-tag>discovery</exclude-tag>
<exclude-tag>internal</exclude-tag>
</exclude-tags>
</context>
Note: It’s important that you specify the attribute type="array" for the following grouped attributes:
user-ids, project-ids, tags and exclude-tags.
Here’s an example of how you’d execute the search using curl, assuming you saved your XML in a file called ‘context.xml’:
curl -k -X POST -T context.xml -H 'Content-Type:application/xml' \ -H 'Accept:application/xml' --user login:password \ https://hotdogzllc.keeptempo.com/entries/search
Parameters
- start-date
Date string field, will be parsed by Ruby and Rails’ to_date methods. Recommended format is YYYY-MM-DD.
- end-date
Date string field, will be parsed by Ruby and Rails’ to_date methods. Recommended format is YYYY-MM-DD.
- interval
-
The presence of this option causes start-date and end-date to be ignored. Provides a number of
convenient short cuts for dynamic date ranges:- today
- yesterday
- thisweek
- lastweek
- last7days
- thismonth
- lastmonth
- thisquarter
- lastquarter
- thisyear
- lastyear
- alltime
- project-ids
An array of
project-idelements, each containing the ID of a project to include in this search.- user-ids
An array of
user-idelements, each containing the ID of a user to include in this search.- tags
An array of
tagelements, each containing the name of a tag to include in this search.- exclude-tags
An array of
exclude-tagelements, each containing the name of a tag to exclude in this search.- exclude-locked
Boolean value indicating whether search should exclude locked entries, defaults to true. Use 1 and 0 for true and false.
- include-inactive
Determines whether or not to include inactive users and inactive projects in the search. defaults to false. Use 1 and 0 for true and false.
/entries/search GET
Beta – New
This is a new method, only available in beta.
Redirects to /reports/search GET. Exists just to help migrate to beta from /entries/search POST.
/entries/:id GET
Request an entry by ID, i.e. /entries/1024.
/entries/:id PUT
Allows you to update an entry by posting an entry object to the collection member, i.e. /entries/1024.
For the list of attributes that can and cannot be updated, see /entries GET.
/entries/:id DELETE
Allows you to delete an entry by ID.
/entries/:id/edit GET
Supplies a description of the entry object in its current state.
/entries/:id/lock POST
Allows you to lock an entry.
/entries/:id/unlock POST
Allows you to unlock an entry.
/entries/:id/start POST
Causes the entry to start a timer. Will cause any other running timer to stop, as a consequence. Timing is additive, so any time logged will be added to the current value stored in hours when the timer is stopped.
/entries/:id/stop POST
Stops an entry’s timer. Timing is additive, so stopping the timer causes the time to be added to the value already present in the entry’s hours attribute.
