Apollo API Documentation

Time tracking API calls

Please note: The label 'contact-id' is intended to define a relation toward a generic CRM object (i.e. a contact, a case or a deal).


Get all entries (for a project)

GET /projects/#{project_id}/timeEntries/#{page}

Returns a page full of time entries for the given project, in descending order by date. Each page contains up to 50 time entry records. To select a different page of data, set the “page” query parameter to a value greater than one.

Response

{
	"continued-at":"/projects/97387934/timeEntries/2",
	"time-entries":[
		{
			"id":"87855111",
			"time-category-id":"97996122",
			"user-id":"68005042",
			...
		},
		{
			"id":"82171591",
			"time-category-id":"48691502",
			"user-id":"55071099",
			...
		},
		...
	]
}

Get all entries (for a task)

GET /tasks/#{task_id}/timeEntries

Returns all time entries associated with the given task item, in descending order by date.

Response

{
	"time-entries":[
		{
			"id":"87855111",
			"time-category-id":"97996122",
			"user-id":"68005042",
			...
		},
		{
			"id":"82171591",
			"time-category-id":"48691502",
			"user-id":"55071099",
			...
		},
		...
	]
}

Get all entries (for a contact)

GET /contacts/#{contact_id}/timeEntries

Returns a page full of time entries for the given contact, in descending order by date. Each page contains up to 50 time entry records. To select a different page of data, set the “page” query parameter to a value greater than one.

Response

{
	"continued-at":"/contacts/67664788/timeEntries/2",
	"time-entries":[
		{
			"id":"87855111",
			"time-category-id":"97996122",
			"user-id":"68005042",
			...
		},
		{
			"id":"82171591",
			"time-category-id":"48691502",
			"user-id":"55071099",
			...
		},
		...
	]
}

Get time entry

GET /timeEntries/#{id}

Returns a single time entry record identified by its integer ID.

Response

{
	"time-entry":{
		"id":"87855111",
		"time-category-id":"97996122",
		"user-id":"68005042",
		...
	}
}

Create entry (for a project)

POST /projects/#{project_id}/timeEntries

Creates a new time entry for the given project.

Request

{
	"time-entry":{
		"category-id":"67909862",
		"user-id":"92970015",
		"notes":"Working hard",
		"date":"2012-07-05",
		// Possible values for “billable” key are:
		//	- unset
		//	- not billable
		//	- billable
		//	- billed
		"billable":"billable",
		"seconds":"3600"
	}
}

Response

Returns HTTP status code 201 (“Created”) on success. The response contain the new time entry ID. On failure, a non-200 status code will be returned, possibly with error information in JSON format as the response's content.

{
	"time-entry-id":"9056560"
}

Create entry (for a task item)

POST /tasks/#{task_id}/timeEntries

Creates a new time entry for the given task.

Request

{
	"time-entry":{
		"category-id":"71615978",
		"user-id":"38904512",
		"notes":"Working hard",
		"date":"2012-07-05",
		// Possible values for “billable” key are:
		//	- unset
		//	- not billable
		//	- billable
		//	- billed
		"billable":"billable",
		"seconds":"3600"
	}
}

Response

Returns HTTP status code 201 (“Created”) on success. The response contain the new time entry ID. On failure, a non-200 status code will be returned, possibly with error information in JSON format as the response's content.

{
	"time-entry-id":"9056560"
}

Create entry (for a contact)

POST /contacts/#{contact_id}/timeEntries

Creates a new time entry for the given contact.

Request

{
	"time-entry":{
		"category-id":"71615978",
		"user-id":"38904512",
		"notes":"Working hard",
		"date":"2012-07-05",
		// Possible values for “billable” key are:
		//	- unset
		//	- not billable
		//	- billable
		//	- billed
		"billable":"billable",
		"seconds":"3600"
	}
}

Response

Returns HTTP status code 201 (“Created”) on success. The response contain the new time entry ID. On failure, a non-200 status code will be returned, possibly with error information in JSON format as the response's content.

{
	"time-entry-id":"9056560"
}

Update time entry

PUT /timeEntries/#{id}

Updates the given time-entry record with the data given.

Request

{
	"time-entry":{
		"category-id":"72077059",
		"notes":"Working hard",
		"date":"2012-08-05"
	}
}

Response

Returns HTTP status code 200 on success, or any other code (and possibly error information in JSON format) on error.


Destroy time entry

DELETE /timeEntries/#{id}

Destroys the given time entry record.

Response

Returns HTTP status code 200 on success, or any other code (and possibly error information in JSON format) on error.


Report

GET /report/timeEntries

Return the set of time entries that match the given criteria. By default, it show time entries on projects for the last 6 months.

Name Default Description
include_personal false Include personal user time entries.
include_projects true Include time entries related to projects.
include_contacts false Include time entries related to contacts.
include_cases false Include time entries related to cases.
include_deals false Include time entries related to deals.
from (6 months ago) Start date in “YYYYMMDD” format (or in any other format accepted by the PHP function date()).
to (today) End date in “YYYYMMDD” format (or in any other format accepted by the PHP function date()).
user_id none Restrict to a single person's time entries.
company_id none Restrict to time entries of the given company.
task_id none Restrict to time entries related to the given task.
project_id none Restrict to time entries of the given project.
with_totals false Add an object containing the totals to the response data.

Please keep in mind that from and to cannot be used to get more than 6 months worth of entries for each query, and that contact-id can be either a contact, a case or a deal.

Response

{
	"time-entries":[
		{
			"id":"87855111",
			"time-category-id":"97996122",
			"user-id":"68005042",
			...
		},
		{
			"id":"82171591",
			"time-category-id":"48691502",
			"user-id":"55071099",
			...
		},
		...
	],
	// Only if you pass the “with_totals” parameter
	"totals":{
		"number-of-entries":30,
		"sum-of-seconds":694680,
		"sum-of-unset-seconds":"691080",
		"sum-of-billable-seconds":0,
		"sum-of-non-billable-seconds":0,
		"sum-of-billed-seconds":"3600"
	}
}