Getting Started

The TicketSource API adheres where possible to the Representational State Transfer (REST) architectural style which allows us to offer consistent and predictable endpoints for a variety of resources in your TicketSource account.

Credentials

You can obtain your API Key from the Account > API Details menu option in your TicketSource account.

Authentication

All calls to the TicketSource API must be authenticated, you can authenticate your calls by providing your API key in one of two ways:

HTTP Basic Auth username

You can provide your API key as the username portion of the HTTP Basic Authentication header, you can leave the password empty.

$apiKey
$curl = curl_init('https://api.ticketsource.io/events');
curl_setopt($curl, CURLOPT_USERPWD, 'skl-xxxxxxxxxx'.':');
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
$response = curl_exec($curl);

Bearer Token

You can provide your API key as the Bearer token authorization HTTP header.

$curl = curl_init('https://api.ticketsource.io/events');
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
    'Authorization: Bearer '.'skl-xxxxxxxxxx'
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
$response = curl_exec($curl);

Endpoints

All calls are made against the following base URL:

https://api.ticketsource.io

The endpoints on offer typically adhere to the following URL patterns:

Pattern Description
https://api.ticketsource.io/resource A paginated list of a particular resource.
https://api.ticketsource.io/resource/identifier Details of a single resource.
https://api.ticketsource.io/resource/identifier/sub-resource A list of resources related to the identified resource.

Responses

All responses follow a simple structure and include additional information depending on the type of response (list/individual resource etc.).

Sample Response:

{
    "data": [
        ...
    ],
    "links": {
        "first": "https://api.ticketsource.io/events?page=1",
        "last": null,
        "prev": null,
        "next": "https://api.ticketsource.io/events?page=2"
    },
    "meta": {
        "current_page": 1,
        "from": 1,
        "path": "https://api.ticketsource.io/events",
        "per_page": 10,
        "to": 10
    }
}

The response includes some useful information along with the resource(s) requested.

  • data will be either an array of objects when requesting a resource index endpoint such as /events or a single object when requesting a specific resource instance endpoint such as /events/evt-xxxxxxxxx1
  • links contains pagination links for requesting more records. See Pagination below for more information.
  • meta contains extra information on the current page in the paginated result list.

Among the properties of a resource object the links property is one of the most useful. Every resource object returned by the TicketSource API will have this property and it contains a link to the resource itself and links to all related resources of that resource. This information allows your integration to navigate between the endpoints it needs without having to hard code them.

Pagination

The pagination links provided in a response will allow your integration to navigate the list pages and the meta property gives information on the current page and the list itself.

You can configure the number of results in a paginated page by passing a per_page query string parameter. The value must be an integer and no greater than 50 to be accepted.

Sample Request:

//Request with a per_page value of 50
$curl = curl_init('https://api.ticketsource.io/events?per_page=50');
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
    'Authorization: Bearer '.'skl-xxxxxxxxxx'
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
$response = curl_exec($curl);
$events = json_decode($response);

//Page two of the request
$curl = curl_init('https://api.ticketsource.io/events?page=2&per_page=50');
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
    'Authorization: Bearer '.'skl-xxxxxxxxxx'
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
$response = curl_exec($curl);
$events = json_decode($response);

Filtering

You can filter any list requests by passing a filter parameter with the following structure (filtering on the created_at property):

{
    "created_at": {
        "operator": "before",
        "value": "2019-01-01"
    }
}

This would filter the list by records with a created_at date before the 1st of January 2019. As a query string this would look like:

?filter[created_at][operator]=before&filter[created_at][value]=2019-01-01

You can currently only filter on created_at and updated_at on all list requests however this list will grow to cover almost all properties of any given resource.

Best practices

Caching

You should cache the responses you get from the TicketSource API locally (i.e. in a database), especially from resources that aren't likely to change often (e.g. Events). This will improve the your performance of your application and reduce the likelihood that you are rate limited (we currently allow 180 calls per minute to any single endpoint).

HTTP2

If your client supports it you should be using the HTTP2 protocol. HTTP2 offers increased performance through header compression, multiplexing and being a binary protocol. With HTTP2 you can make a single connection to the TicketSource API then make multiple calls for lists of resources, their details and their related resources.

Menu