Working with Bookings
You can retrieve your booking data for customers and dates through the TicketSource API. This guide will go through the necessary call to retrieve this information which can be used for analysis or syncing with external CRM systems.
If you haven't already, you should go through our getting started guide for instructions on obtaining credentials and how to authenticate with the API.
Bookings
You can retrieve a list of all Bookings for a particular Date resource by querying the /dates/dat-xxxxxxxxxx1/bookings endpoint.
Information panel
You can also get a
list of all Bookings for an Customer
.
Sample Request:
$curl = curl_init('https://api.ticketsource.io/dates/dat-xxxxxxxxxx1/bookings');
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer '.'skl-xxxxxxxxxx'
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
$response = curl_exec($curl);
$bookings = json_decode($response);
Sample Response:
{
"data": [
{
"id": "bkg-xxxxxxxxxx1",
"type": "booking",
"attributes": {
"ref": "ABC123",
"lines": [
{
"line_type": "TICKETS",
"payment_method": "STRIPE",
"is_refund": false,
"amount": {
"gross": 1,
"fee": 0.38,
"fee_vat": 0.08,
"discounts": {
"automatic": 0,
"code": {
"description": "",
"amount": 0
}
},
"net": 0.54
},
"created_at": "2019-02-12T10:58:34+00:00",
"updated_at": null
},
{
"line_type": "TICKETS",
"payment_method": "STRIPE",
"is_refund": true,
"amount": {
"gross": -1,
"fee": -0.38,
"fee_vat": -0.08,
"discounts": {
"automatic": 0,
"code": {
"description": null,
"amount": 0
}
},
"net": -0.54
},
"created_at": "2019-02-12T10:58:34+00:00",
"updated_at": null
}
],
"consent": {
"third_party": "Visiting Theatre Ltd",
"email": true,
"post": true,
"sms": false
},
"user_booked_by": "",
"created_at": "2019-02-12T10:58:34+00:00",
"updated_at": "2019-02-12T10:58:34+00:00"
},
"links": {
"self": "https://api.ticketsource.io/bookings/bkg-xxxxxxxxxxxxxxx1",
"seats": "https://api.ticketsource.io/bookings/bkg-xxxxxxxxxxxxxxx1/seats",
"customer": "https://api.ticketsource.io/customers/cst-xxxxxxxxxxxxxxx1",
"date": "https://api.ticketsource.io/dates/dat-xxxxxxxxxxxxxxx1"
}
},
{
...
}
],
"links": {
"first": "https://api.ticketsource.io/dates/dat-xxxxxxxxxx1/bookings?page=1",
"last": null,
"prev": null,
"next": "https://api.ticketsource.io/dates/dat-xxxxxxxxxx1/bookings?page=2"
},
"meta": {
"current_page": 1,
"from": 1,
"path": "https://api.ticketsource.io/dates/dat-xxxxxxxxxx1/bookings",
"per_page": 10,
"to": 10
}
}
Information panel
You can find out more about the properties of a Booking resource in our
API specification.
Seats/Places
You can retrieve a list of all Seats for a particular Booking resource by querying the /bookings/bkg-xxxxxxxxxx1/seats endpoint.
Sample Request:
$curl = curl_init('https://api.ticketsource.io/bookings/bkg-xxxxxxxxxx1/seats');
curl_setopt($curl, CURLOPT_HTTPHEADER, array(
'Authorization: Bearer '.'skl-xxxxxxxxxx'
));
curl_setopt($curl, CURLOPT_RETURNTRANSFER, TRUE);
$response = curl_exec($curl);
$bookings = json_decode($response);
Sample Response:
{
"data": [
{
"id": "sea-xxxxxxxxxxxxxxx1",
"type": "seat",
"attributes": {
"is_booked": true,
"is_cancelled": false,
"reference": {
"row": "A",
"seat": 26
},
"price_category": "Adult",
"attendee": {
"title": "",
"first_name": "A",
"last_name": "Person",
"company": {
"name": "Examplecorp",
"title": "CEO"
},
"telephone": "",
"email": "a.person@example.com"
},
"created_at": "2019-02-12T10:58:34+00:00",
"updated_at": null
},
"links": {
"self": "https://api.ticketsource.io/venues/sea-xxxxxxxxxxxxxxx1",
"booking": "https://api.ticketsource.io/bookings/bkg-xxxxxxxxxxxxxxx1"
}
},
{
"id": "sea-xxxxxxxxxxxxxxx2",
"type": "seat",
"attributes": {
"is_booked": true,
"is_cancelled": false,
"reference": {
"row": "A",
"seat": 27
},
"price_category": "Adult",
"attendee": {
"title": "",
"first_name": "A",
"last_name": "Nother",
"company": {
"name": "Examplecorp",
"title": "CTO"
},
"telephone": "",
"email": "a.nother@example.com"
},
"created_at": "2019-02-12T10:58:34+00:00",
"updated_at": null
},
"links": {
"self": "https://api.ticketsource.io/venues/sea-xxxxxxxxxxxxxxx2",
"booking": "https://api.ticketsource.io/bookings/bkg-xxxxxxxxxxxxxxx1"
}
},
{
...
}
],
"links": {
"first": "https://api.ticketsource.io/bookings/bkg-xxxxxxxxxx1/seats?page=1",
"last": null,
"prev": null,
"next": "https://api.ticketsource.io/bookings/bkg-xxxxxxxxxx1/seats?page=2"
},
"meta": {
"current_page": 1,
"from": 1,
"path": "https://api.ticketsource.io/bookings/bkg-xxxxxxxxxx1/seats",
"per_page": 10,
"to": 10
}
}