Apollo API Documentation

Deals API calls


List all deals

GET /deals?status=#{status}&page=#{page}

Returns a collection of deals that are visible to the authenticated user. Possible values for “status” parameter can be pending, win or lost (if you don't pass nothing all deals are returned). The “currency” field is a three-character ISO 4217 currency identifier. The “price-type” field indicates whether the deal bid has a fixed price (“fixed”), or is based on an hourly (“hour”), monthly (“month”) or annual (“year”) price. The “duration” field indicates how many “price-type” units long the deal is expected to span. The “deal-status” field indicates whether the deal is “pending”, “won”, or “lost”. The
“deal-responsible-id” field identifies which user is responsible for this deal. The “deal-category-id” field is the id of the category record for this deal. The “background-info” field is arbitrary text describing this deal. The “involved-people” field is a list of the people and companies involved with this deal. The “deal-with” field is the person or company the deal is with.

Response

{
	"continued-at":"/deals?status=lost&page=2"
	"deals":[
		{
			"id":"50932738",
			"name":"A deal",
			"type":"deal",
			...
		},
		{
			"id":"98170946",
			"name":"Another deal",
			"type":"deal",
			...
		},
		...
	]
}

Get single deal

GET /deals/#{id}

Returns a single deal.

Response

{
	"deal":{
		"id":"50932738",
		"name":"A deal",
		"type":"deal",
		...
	}
}

Create deal

POST /deals

Creates a new deal with the currently authenticated user as the author. By default, a new deal is assumed to be visible to everyone. You can also chose to make the deal 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 deal (note that the creator id is always included). If the account doesn't allow for more deals to be created, a “507 Insufficient Storage” response will be returned.

Request

{
	"deal":{
		"name":"A deal",
		"visibility":"public",
		"deal-status":"pending",
		"deal-with":"6376348",
		"currency":"EUR",
		"price":"456",
		"price-type":"month",
		"duration":"3",
		"deal-category-id":"8123876",
		"deal-responsible-id":"5017357",
		"involved-people":["35596983", "19635763"]
	}
}

Response

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

{
	"deal-id":"74889173"
}

Update deal

PUT /deals/#{id}

Updates an existing deal with new details from the submitted JSON.

Request

{
	"deal":{
		"deal-status":"won",
		"involved-people":["-35596983", "17561816"]
	}
}

Response

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


Destroy deal

DELETE /deals/#{id}

Destroys the given deal.

Response

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