Apollo API Documentation

Contacts API calls


List all contacts

GET /contacts?#{search_query}

Returns a collection of contacts that are visible to the authenticated user. Use the search query to refine your search. Available parameters are:

  • “page”: if the results are many you can jump to the next page using the “page” parameter.
  • “contact-type”: possible values are person or company (if you don't pass nothing both person and company are returned).
  • “tags”: search by tags (multiple tags are comma-separated). Note that if you search by tags you cannot use the following parameters.
  • “title”: search by title. Note that you cannot use this parameter if you search by tags.
  • “company-id”: search by company-id. Note that you cannot use this parameter if you search by tags.
  • “term”: search a term contained in a person or a company name. Note that you cannot use this parameter if you search by tags.
  • “email”: search a contact by email. Note that you cannot use this parameter if you search by tags.

Response

{
	"continued-at":"/contacts?contact-type=person&term=john&page=2"
	"contacts":[
		{
			"id":"10391302",
			"name":"John",
			"last-name":"Smith",
			...
		},
		{
			"id":"83411557",
			"name":"John",
			"last-name":"Williams",
			...
		},
		...
	]
}

List since time

GET /contacts?since=#{since}&page=#{page}

Returns a collection of contacts that are visible to the authenticated user and were created or modified since the date posted. “since” should be a date in “YYYYMMDDHHIISS” format (or in any other format accepted by the PHP function “date()”).

Response

{
	"continued-at":"/contacts?since=20120103163000&page=2"
	"contacts":[
		{
			"id":"10391302",
			"name":"John",
			"last-name":"Smith",
			...
		},
		{
			"id":"83411557",
			"name":"John",
			"last-name":"Williams",
			...
		},
		...
	]
}

Recently viewed

GET /contacts/recentlyViewed/#{page}

Returns a collection of recently viewed contacts.

Response

{
	"continued-at":"/contacts/recentlyViewed/2"
	"contacts":[
		{
			"id":"10391302",
			"name":"John",
			"last-name":"Smith",
			...
		},
		{
			"id":"83411557",
			"name":"John",
			"last-name":"Williams",
			...
		},
		...
	]
}

Get single contact

GET /contacts/#{id}

Returns a single contact.

Response

{
	"contact":{
		"id":"10391302",
		"name":"John",
		"last-name":"Smith",
		...
	}
}

Get contact tags

GET /contacts/#{id}/tags

Returns returns the tags on a person or company.

Response

{
	"tags":{
		"clients":"clients",
		"lawyer":"lawyer",
		...
	}
}

Create contact

POST /contacts

Creates a new person or company with the currently authenticated user as the author. Additionally (in the case you are creating a person), the company-name is used to either lookup a company with that name or create a new one if it didn't already exist. You can also refer to an existing company instead using company-id. By default, a new contact is assumed to be visible to everyone. You can also chose to make the contact only visible to the creator using “only-me” as the value for the visibility key. Or “group” and pass in a group-id key too. Or “selected-people” and pass an array of id of users that can see the contact (note that the creator id is always included). If the account doesn't allow for more contacts to be created, a “507 Insufficient Storage” response will be returned.

Request

{
	"contact":{
		"company-name":"A company",
		"type":"person",
		"name":"John",
		"last-name": "Smith",
		"title":"",
		"background-info":"",
		"visibility":"selected-people",
		"allowed-users":["80270882","63281569","69755015"],
		"contact-data":[
			{
				"entity-type":"phone",
				"entity-value":"3476787XXX",
				"kind":"work"
			},
			{
				"entity-type":"e-mail",
				"entity-value":"jsmith@gmail.com",
				"kind":"personal"
			},
			...
		],
		"important-dates":[
			{
				"type":"birthday",
				"is-every-year":"1",
				"date":"19820705"
			},
			...
		],
		"addresses":[
			{
				"address":"101 Santa Monica Boulevard",
				"city":"Santa Monica",
				"state":"California",
				"country":"United States",
				"zip-code":"90401",
				"kind":"other"
			},
			...
		],
		"attachment":["69733015"]
	}
}

Response

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

{
	"contact-id":"77992963"
}

Update contact

PUT /contacts/#{id}

Updates an existing contact with new details from the submitted JSON. Contact data, important dates and addresses data that include an id will be updated, data that doesn't will be assumed to be new and created from scratch. To remove a piece of data, prefix its id with a minus sign (e.g. “-1”).

Request

{
	"contact":{
		"name":"George",
		"contact-data":[
			{
				"entity-type":"phone",
				"entity-value":"3286987XXX",
				"kind":"personal"
			},
			{
				"id":"-77992911"
			},
			...
		],
		"attachment":["-27169474"]
	}
}

Response

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


Merge contacts

PUT /contacts/merge?looser_id=#{looser_id}&winner_id=#{winner_id}

Merge two existing contacts. All data from the looser will be merged into the winner and the looser will be deleted.

Response

Returns winner's info.

{
	"contact":{
		"id":"10391302",
		"name":"John",
		"last-name":"Smith",
		...
	}
}

Destroy contact

DELETE /contacts/#{id}

Destroys the given contact.

Response

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