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. This action accepts the following query parameters: “from”, “to”, “user_id”, “task_id”, “project_id”, “company_id” and “with_totals”. Both “from” and “to” should be dates in “YYYYMMDD” format (or in any other format accepted by the PHP function “date()”), and can be used to restrict the results to a particular date range (No more than 6 months' worth of entries may be returned in a single query, though). The “user_id” parameter lets you constrain the results to a single person's time entries. “task_id” restricts the results to only those entries relating to the given task item. “project_id” restricts the entries to those for the given project, and “company_id” restricts the entries to those for the given company. The optional “with_totals” parameter add to the response an object containing the totals.

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"
	}
}