The Orders API provides a simple interface to manage orders.

An Order is a list of Line Items associated with a deal.

The API allows you to create, delete and update your orders. You can also retrieve a single order as well as list of all orders.

Line Items, Products and Orders are available only to users who are on the Enterprise plan.

Account administrators can disable changes to these entities in the account settings. When disabled, all data are preserved but only GET requests are allowed.

JSON format

Name Type Read only Description
id number true Unique identifier of the order.
deal_id number true Id of the deal the order is associated to.
discount number true Discount on the whole order in percents.
created_at string true Date and time of when the order was created in UTC (ISO8601 format).
updated_at string true Date and time of the last update in UTC (ISO8601 format).

Retrieve all orders

GET /v2/orders

Returns all orders available to the user according to the parameters provided.

Name Type In Required Description
page number Query false Page number to start from. Page numbering starts at 1, and omitting the page parameter will return the first page. e.g. ?page=2
per_page number Query false Number of records to return per page. Default limit is 25 and the maximum number that can be returned is 100. e.g. ?per_page=20
ids number Query false Comma-separated list of IDs to be returned in request. e.g. ?ids=1,2,3
sort_by string Query false 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=value:desc.
deal_id number Query false Id of the deal order is associated to. e.g. ?deal_id=12

Allowed for

  • Agents

Using cURL

curl -v -X GET https://api.getbase.com/v2/orders \-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,        "deal_id": 12,        "discount": 5,        "created_at": "2015-07-06T16:32:56Z",        "updated_at": "2015-07-06T16:32:56Z"      },      "meta": {        "type": "order"      }    }  ],  "meta": {    "type": "collection",    "count": 1,    "links": {      "self": "http://api.getbase.com/v2/orders?page=1&per_page=25"    }  }}

Create an order

POST /v2/orders
Name Type In Required Description
deal_id number Body true e.g. "deal_id": "12"
discount number Body true e.g. e.g. "discount": "50"

Allowed for

  • Agents

Using cURL

curl -v -X POST https://api.getbase.com/v2/orders \-H "Accept: application/json" \-H "Content-Type: application/json" \-H "Authorization: Bearer $ACCESS_TOKEN" \-d '{  "data": {    "deal_id": 12,    "discount": 50  },  "meta": {    "type": "order"  }}'

Example response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8Content-Language: en
{  "data": {    "id": 19,    "deal_id": 12,    "discount": 50,    "updated_at": "2015-07-07T10:03:19Z",    "created_at": "2015-07-07T10:03:19Z"  },  "meta": {    "type": "order"  }}

Retrieve a single order

GET /v2/orders/:id

Returns a single order available to the user, according to the unique order ID provided. If the specified order does not exist, the request will return an error.

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

Allowed for

  • Agents

Using cURL

curl -v -X GET https://api.getbase.com/v2/orders/1 \-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": 19,    "deal_id": 12,    "discount": 50,    "updated_at": "2015-07-07T10:03:19Z",    "created_at": "2015-07-07T10:03:19Z"  },  "meta": {    "type": "order"  }}

Update an order

PUT /v2/orders/:id

Updates order information. If the specified order does not exist, the request will return an error.

Name Type In Required Description
deal_id number Body false e.g. "deal_id": "12"
discount number Body false e.g. "discount": "25"

Allowed for

  • Agents

Using cURL

curl -v -X PUT https://api.getbase.com/v2/orders/1 \-H "Accept: application/json" \-H "Content-Type: application/json" \-H "Authorization: Bearer $ACCESS_TOKEN" \-d '{  "data": {    "discount": 25  }}'

Example response

HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8Content-Language: en
{  "data": {    "id": 1,    "deal_id": 12,    "discount": 25,    "updated_at": "2015-07-08T13:03:19Z",    "created_at": "2015-07-07T10:03:19Z"  },  "meta": {    "type": "order"  }}

Delete an order

PUT /v2/orders/:id

Delete an existing order and remove all of the associated line items in a single call. If the specified order does not exist, the request will return an error. This operation cannot be undone.

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

Allowed for

  • Agents

Using cURL

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

Example response

HTTP/1.1 204 No Content