The Deal Sources API provides a simple interface to manage deal sources. The API allows you to create, delete and update your sources. You can retrieve a single source as well as list of all sources.

JSON format

Name Read Only Type Description
id true number Unique identifier of the deal source.
creator_id true number Unique identifier of the user that created the source.
name false string Name of the source. e.g. Word of mouth
resource_type false string Type name of the resource the source is attached to. Possible values: deal
created_at true string Date and time of creation in UTC (ISO 8601 format).
updated_at true string Date and time of the last update in UTC (ISO 8601 format).

Retrieve all sources

GET /v2/deal_sources

Returns all deal sources available to the user according to the parameters provided.

Parameters

Name Required Type In Description
page optional number Query Page number to start from. Page numbering starts at 1, and omitting the page parameter will return the first page.
per_page optional number Query Number of records to return per page. The default limit is 25 and the maximum number that can be returned is 100.
sort_by optional string Query A field to sort by. The default ordering is ascending. If you want to change the sort order to descending, append :desc to the field e.g. sort_by=name:desc. Possible values: id, name, updated_at, created_at
ids optional string Query Comma-separated list of deal source IDs to be returned in a request.
name optional string Query Name of the source 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/deal_sources-H "Accept: application/json"-H "Authorization: Bearer $ACCESS_TOKEN"

Example response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8Content-Language: en
{  "items": [    {      "data": {        "id": 1,        "creator_id": 1,        "name": "Our website",        "resource_type": "deal",        "created_at": "2014-08-27T16:32:56Z",        "updated_at": "2014-08-27T16:32:56Z"      },      "meta": {        "type": "source"      }    },    {      "data": {        "id": 2,        "creator_id": 1,        "name": "Word of mouth",        "resource_type": "deal",        "created_at": "2014-08-27T16:32:57Z",        "updated_at": "2014-08-27T16:32:57Z"      },      "meta": {        "type": "source"      }    },    {      "data": {        "id": 3,        "creator_id": 1,        "name": "Referral",        "resource_type": "deal",        "created_at": "2014-08-27T16:32:58Z",        "updated_at": "2014-08-27T16:32:58Z"      },      "meta": {        "type": "source"      }    },    {      "data": {        "id": 4,        "creator_id": 1,        "name": "Newspaper ad",        "resource_type": "deal",        "created_at": "2014-08-27T16:32:59Z",        "updated_at": "2014-08-27T16:32:59Z"      },      "meta": {        "type": "source"      }    }  ],  "meta": {    "type": "collection",    "count": 4,    "links": {      "self": "http://api.getbase.com/v2/sources.json"    }  }}

Create a source

POST /v2/deal_sources

Creates a new source. Source's name must be unique.

Parameters

Name Required Type In Description
name required string Body Must be unique.
resource_type optional string Body e.g. deal

Allowed for

  • Agents

Using cURL

curl -v -X POST https://api.getbase.com/v2/deal_sources-H "Accept: application/json"-H "Content-Type: application/json"-H "Authorization: Bearer $ACCESS_TOKEN"-d '{  "data": {    "name": "Tom"  },  "meta": {    "type": "source"  }}'

Example response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8Content-Language: en
{  "data": {    "id": 5,    "creator_id": 1,    "name": "Tom",    "resource_type": "deal",    "created_at": "2014-08-27T16:33:00Z",    "updated_at": "2014-08-27T16:33:00Z"  },  "meta": {    "type": "source"  }}

Retrieve a single source

GET /v2/deal_sources/:id

Returns a single source available to the user by the provided id. If a source 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 source.

Allowed for

  • Agents

Using cURL

curl -v -X GET https://api.getbase.com/v2/deal_sources/5 \-H "Accept: application/json" \-H "Authorization: Bearer $ACCESS_TOKEN"

Example response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8Content-Language: en
{  "data": {    "id": 5,    "creator_id": 1,    "name": "Tom",    "resource_type": "deal",    "created_at": "2014-08-27T16:33:00Z",    "updated_at": "2014-08-27T16:33:00Z"  },  "meta": {    "type": "source"  }}

Update a source

PUT /v2/deal_sources/:id

Updates source information. If the specified source does not exist, the request will return an error. If you want to update a source, you must make sure source's name is unique.

Parameters

Name Required Type In Description
id true number Query Source ID.
name false string Body Must be unique. e.g. Tom referral
resource_type false string Body e.g. deal

Allowed for

  • Agents

Using cURL

curl -v -X PUT https://api.getbase.com/v2/deal_sources/5 \-H "Accept: application/json" \-H "Content-Type: application/json" \-H "Authorization: Bearer $ACCESS_TOKEN" \-d '{  "data": {    "name": "Tom referral"  }}'

Example response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8Content-Language: en
{  "data": {    "id": 5,    "creator_id": 1,    "name": "Tom referral",    "resource_type": "deal",    "created_at": "2014-08-27T16:33:00Z",    "updated_at": "2014-08-27T16:33:01Z"  },  "meta": {    "type": "source"  }}

Delete a source

DELETE /v2/deal_sources/:id

Delete an existing source. If the specified source does not exist, the request will return an error. This operation cannot be undone.

Parameters

Name Required Type In Description
id true number Query Unique identifier of the source.

Allowed for

  • Agents

Using cURL

curl -v -X DELETE https://api.getbase.com/v2/deal_sources/1 \-H "Authorization: Bearer $ACCESS_TOKEN"

Example response

HTTP/1.1 204 No Content