Loss Reasons
The Deal Loss Reasons API provides a simple interface to manage deal loss reasons. The API allows you to create, delete and update loss reasons. You can retrieve a single reasons as well as list of all reasons.
JSON format
Name | Read Only | Type | Description |
---|---|---|---|
id | true | number | Unique identifier of the loss reason. |
creator_id | true | number | Unique identifier of the user the loss reason was created by. |
name | false | string | Human-friendly loss reason explanation. |
created_at | true | string | Date and time of creation in UTC ISO8601 format. |
updated_at | true | string | Date and time of the last update in UTC ISO8601 format. |
Retrieve all reasons
GET /v2/loss_reasons
Returns all deal loss reasons available to the user according to the parameters provided.
Parameters
Name | Required | Type | In | Description |
---|---|---|---|---|
page | false | number | Query | Page number to start from. Page numbering is 1-based and omitting page parameter will return the first page. |
per_page | false | number | Query | Number of records to return per page. Default limit is 25 and maximum number that can be returned is 100. |
sort_by | false | string | Query | A field to sort by. Default ordering is ascending. If you want to change the sort ordering to descending, append :desc to the field e.g. sort_by=name:desc . Possible values: id , name , updated_at , created_at |
ids | false | string | Query | Comma separated list of deal loss reasons unique identifiers to be returned in a request. |
name | false | string | Query | Name of the loss reason to search for. This parameter is used in a strict sense. |
Allowed for
- Agents
Using cURL
curl -v -X GET https://api.getbase.com/v2/loss_reasons \
-H "Accept: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN"
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Content-Language: en
{
"items": [
{
"data": {
"id": 1,
"creator_id": 1,
"name": "We were too expensive",
"created_at": "2014-08-27T16:32:56Z",
"updated_at": "2014-08-27T16:32:56Z"
},
"meta": {
"type": "loss_reason"
}
},
{
"data": {
"id": 2,
"creator_id": 1,
"name": "Chosen a competitor",
"created_at": "2014-08-27T16:32:57Z",
"updated_at": "2014-08-27T16:32:57Z"
},
"meta": {
"type": "loss_reason"
}
},
{
"data": {
"id": 3,
"creator_id": 1,
"name": "Poor follow up",
"created_at": "2014-08-27T16:32:58Z",
"updated_at": "2014-08-27T16:32:58Z"
},
"meta": {
"type": "loss_reason"
}
}
],
"meta": {
"type": "collection",
"count": 3,
"links": {
"self": "http://api.getbase.com/v2/loss_reasons.json"
}
}
}
Create a loss reason
POST /v2/loss_reasons
Create a new loss reason. Loss reason's name must be unique.
Parameters
Name | Required | Type | In | Description |
---|---|---|---|---|
name | true | string | Body | Must be unique. e.g. Lack of communication |
Allowed for
- Agents
Using cURL
curl -v -X POST https://api.getbase.com/v2/loss_reasons \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-d '{
"data": {
"name": "Lack of communication"
},
"meta": {
"type": "loss_reason"
}
}'
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Content-Language: en
{
"data": {
"id": 4,
"creator_id": 1,
"name": "Lack of communication",
"created_at": "2014-08-27T16:33:00Z",
"updated_at": "2014-08-27T16:33:00Z"
},
"meta": {
"type": "loss_reason"
}
}
Retrieve a single reason
GET /v2/loss_reasons/:id
Returns a single loss reason available to the user by the provided id. If a loss reason with the supplied unique identifier does not exist, it returns an error.
Parameters
Name | Required | Type | In | Description |
---|---|---|---|---|
id | true | number | Query | Unique identifier of the loss reason. |
Allowed for
- Agents
Using cURL
curl -v -X GET https://api.getbase.com/v2/loss_reasons/4 \
-H "Accept: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN"
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Content-Language: en
{
"data": {
"id": 4,
"creator_id": 1,
"name": "Lack of communication",
"created_at": "2014-08-27T16:33:00Z",
"updated_at": "2014-08-27T16:33:00Z"
},
"meta": {
"type": "loss_reason"
}
}
Update a loss reason
PUT /v2/loss_reasons/:id
Updates a loss reason information. If the specified loss reason does not exist, the request will return an error.
If you want to update loss reason you must make sure name of the reason is unique.
Parameters
Name | Required | Type | In | Description |
---|---|---|---|---|
id | true | number | Query | Unique identifier of the loss reason. |
name | false | string | Body | Must be unique. |
Allowed for
- Agents
Using cURL
curl -v -X PUT https://api.getbase.com/v2/loss_reasons/4 \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-d '{
"data": {
"name": "Lack of communication with contact"
}
}'
Example response
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
Content-Language: en
{
"data": {
"id": 4,
"creator_id": 1,
"name": "Lack of communication with contact",
"created_at": "2014-08-27T16:33:00Z",
"updated_at": "2014-08-27T16:33:01Z"
},
"meta": {
"type": "loss_reason"
}
}
Delete a reason
DELETE /v2/loss_reasons/:id
Delete an existing loss reason. If the reason with supplied unique identifier does not exist it returns an error. This operation cannot be undone.
Parameters
Name | Required | Type | In | Description |
---|---|---|---|---|
id | true | number | Query | Unique identifier of the loss reason. |
Allowed for
- Agents
Using cURL
curl -v -X DELETE https://api.getbase.com/v2/loss_reasons/1 \
-H "Authorization: Bearer $ACCESS_TOKEN"
Example response
HTTP/1.1 204 No Content