Intervals API Resource: timer

The base URL for this resource is located at
https://api.myintervals.com/timer/

Timers are tricky business, complicated not just by the fact that there are two types of them (task timers and general timers). Executive users don't have access to them, and all time must be stored in UTC. For task timers, a user cannot have more than one timer for a particular task.

Timers rely on two fields: time (number of seconds) and starttime (timestamp). Whenever starttime is blank, it indicates that it's paused, and time contains amount of seconds recorded. If starttime is not blank, it indicates the timer is running.

To start a timer: set the starttime field to the current time in UTC.

To pause a timer: calculate the amount of time lapsed between the starttime and now, and sum that value with the value in the time field (i.e. time = time + (now - starttime)). Then nullify the starttime field.

To resume a timer: set the starttime field to the current time in UTC. Leave the existing value in the time field.

To apply a timer: A timer must be paused before it can be applied. Therefore, applying a timer to a time entry is as simple as reading the value of the time field.

Collection

Allowed HTTP Methods
MethodGroup Access
GETAdministrator, Manager, Resource
Allowed Filters
Filter NameRequired?ExpectsDefaultDescription
generaltimers no boolean Ordinarily, the list returns a list of active task timers. Appending this to your request returns the list of General Timers. Setting this to true returns the list of General Timers.
gettimerinfo no boolean Setting this to true combines the list to return both general timers AND task timers in one request, and returns extra task information for task timers.
taskid no integer
personid no integer
projectid no integer
clientid no integer
sortfield no string Sort the list by any of the following fields: lastupdate
sortdir no string Sets the sort direction of the returned list. Must be either "ASC" or "DESC".
offset no integer Return timers starting from the nth timer.
limit no integer 10 Sets a limit to the amount of timers returned in the response.

1 Indicates that multiple values are allowed, in CSV format (e.g. "3,5,11,19").
2 This field accepts HTML, but certain HTML elements may be stripped out.

Examples

To retrieve the entire list of this resource:

GET /timer/

To filter the list based on certain parameters:

GET /timer/?sortfield={value}

Note: You can string together multiple filters.

Member

Allowed HTTP Methods
MethodGroup Access
GETAdministrator, Manager, Resource
DELETEAdministrator, Manager, Resource
POSTAdministrator, Manager, Resource
PUTAdministrator, Manager, Resource
Settable Fields for PUT and POST Requests
Field NameRequired?ExpectsDefaultDescription
taskid no integer The ID of the task this timer is associated with. If left blank, this timer will be a General Timer
personid yes integer The ID of the person this timer is associated with.
starttime no datetime REQUIRED IF time field is blank. Setting this field indicates that a timer is running. If missing, server time will be used when creating a new timer.
time no double REQUIRED IF starttime field is blank.
timelapsed no double Time elapsed since timer was started. This field is ready only.
name no string (255) A description you want to apply to the timer.
lastupdate no date The date on which the timer was last started or stopped

string (xxx) indicates a string with a maximum length of xxx characters.

Examples

To retrieve one member resource:

GET /timer/{id}/

Assuming no errors, the server will respond with 200 OK and the object requested.

To delete a particular member resource:

DELETE /timer/{id}/

Assuming no errors, the server will respond with 200 OK.

To create a new member resource:

POST /timer/
{
    "personid": value
}

Assuming no errors, the server will respond with 201 Created and the newly-created element. This will allow you to get the id of the item you just created and verify the field values. Note: Only required fields were listed here. The entire list of possible fields is above.

To update a member resource:

PUT /timer/{id}/
{
    "personid": value,
    "starttime": value
}

Assuming no errors, the server will respond with 202 Accepted and the entire element. This will allow you to verify the field values.

Don’t have an Intervals account? Start your own unlimited trial.

No credit card required. No software to install. Cancel any time.

Try it Free