This is not reponsive yet.

Getting started

Welcome to the Brighton Getaways REST API.

Our API is a closed invite-only API. Please contact us for information.

REST takes advantage of the HTTP request methods to layer itself into the existing HTTP architecture. These operations consist of the following:

  • GET: Used for basic read requests to the server
  • PUT: Used to modify an existing object on the server
  • POST: Used to create a new object on the server
  • DELETE: Used to remove an object on the server

API versions

  • V1: 20th October 2017

Building a request

Requests must be over HTTPS/SSL and are built as follows:
https://api.brightongetaways.com/v1/endpoint/operation/parameters

Authentication

The BrightonGetaways API requires an API Key. An API key is a token that a client provides when making API calls. The key can be sent in the query string:

Authorization Header

Sending the key via Authorization headers.

PHP: CURL
$headers = array();
$headers[] = 'Authorization: f947828e433db5e955c3987d91e7e3f7';
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);


Query string

You can also append the api_key to the URL. An example GET request might look like:

GET /v1/property/get/45?api_key=f947828e433db5e955c3987d91e7e3f7

API keys are supposed to be a secret that only the client and server know. Like Basic authentication, API key-based authentication is only considered secure if used together with other security mechanisms such as HTTPS/SSL.


Getting an API Key

Our API is a closed invite-only API. Please contact us for information.

Response formats

The API responds in JSON only.

Every call to the API is structured with an error (int) status and error_text (string), followed by the actual response (array), for example:

GET /v1/property/get/99

-- response --
{
	"error": 0,
	"error_text": "",
	"response": {
		"count": 1,
		"items": {
			"45": {
				"property_id": "99",
				"active": "0",
				"title": "Really cool property",
				"address": "Flat 3, 2 Main Road, Brighton, BN1 1AA",
				"postcode": "BN1 1AA",
				"latitude": "50.822222",
				"longitude": "-0.154444",
				"sleeps": "6",
				"property_type_id": "1",
				"property_type": "Apartment",
				"property_category_id": "1",
				"property_category": "Standard",
				"beds": "2",
				"bedrooms": "1",
				"bathrooms": "1"
			}
		}
	}
}

Errors

If an error exists, the error (int) status will be 1, with text information in error_text (string). If no errors exist, error (int) status will be returned as 0.

An example error is when the API Key is invalid:

GET /v1/property/get/99?api_key=AN_EXPIRED_KEY

-- response --
{
    "error": 1,
    "error_text": "API Key invalid.",
    "response": []
}

CORS: Cross Origin Resource Sharing

The BrightonGetaways API supports CORS, but API Keys may be limited by host.

Historically, Javascript AJAX requests were restricted to a same domain origin policy. With CORS it is now possible to access data across domains.

# jQuery example for CORS request.

$.ajax({
	url : '/v1/property/get/99',
	timeout: 7000,
	type : 'PUT',
	data: send_data,
	xhrFields: {
		withCredentials: true
	},
	crossDomain: true,
	success : function(data) {
		//
	},
	error : function(data, error, m) {
		//
	}
});

Rate limiting

API Keys may be limited.

Please contact us for more information.

All properties

Get a list of all properties:

GET /v1/property/get

Response:

{
	"error": 0,
	"error_text": "",
	"response": {
		"count": 2,
		"items": {
			"74": {
				"property_id": "74",
				"active": "0",
				"title": "Brighton Apartment",
				"address": "44 Hove Road, Brighton, BN1 3AA",
				"postcode": "BN1 3AA",
				"latitude": "50.822222",
				"longitude": "-0.144444",
				"sleeps": "6",
				"property_type_id": "1",
				"property_type": "Apartment",
				"property_category_id": "1",
				"property_category": "Standard",
				"beds": "4",
				"bedrooms": "2",
				"bathrooms": "1"
			},
			"86": {
				"property_id": "86",
				"active": "0",
				"title": "Brighton House",
				"address": "West Street, Brighton",
				"postcode": "",
				"latitude": "50.833333",
				"longitude": "-0.122222",
				"sleeps": "6",
				"property_type_id": "2",
				"property_type": "House",
				"property_category_id": "1",
				"property_category": "Standard",
				"beds": "8",
				"bedrooms": "3",
				"bathrooms": "2"
			}
		}
	}
}

Single property

Get information for a single property. If property is not found, count (int) will be 0.

GET /v1/property/get/[PROPERTY_ID]

Response:

{
	"error": 0,
	"error_text": "",
	"response": {
		"count": 1,
		"items": {
			"74": {
				"property_id": "74",
				"active": "0",
				"title": "Brighton Apartment",
				"address": "44 Hove Road, Brighton, BN1 3AA",
				"postcode": "BN1 3AA",
				"latitude": "50.822222",
				"longitude": "-0.144444",
				"sleeps": "6",
				"property_type_id": "1",
				"property_type": "Apartment",
				"property_category_id": "1",
				"property_category": "Standard",
				"beds": "4",
				"bedrooms": "2",
				"bathrooms": "1"
			}
		}
	}
}

Single property with occupant / booking information

Get the current occupant and booking info for the property PROPERTY_ID. If no current active booking exists, count (int) will be 0 and items (array) will be empty.

GET /v1/property/get/[PROPERTY_ID]/occupant

Response:

{
	"error": 0,
	"error_text": "",
	"response": {
		"count": 1,
		"items": [{
			"booking_id": "41589",
			"checkin": "2017-10-20T00:00:00+00:00",
			"checkout": "2017-10-22T00:00:00+00:00",
			"customer_name": "Jane Smith",
			"customer_phone": "+44 7489 111888",
			"property_manager": [{
				"manager_name": "John",
				"manager_email": "john@brightongetaways.com",
				"manager_phone": "07545454545"
			}],
			"noise_officer": [{
				"officer_name": "Ken",
				"officer_email": "ken@brightongetaways.com",
				"officer_phone": "07589589589"
			}]
		}]
	}
}

Property types

Get a list of all the property types.

GET /v1/property/type

Response:

{
	"error": 0,
	"error_text": "",
	"response": {
		"count": 3,
		"items": {
			1: "Apartment",
			2: "House",
			3: "Hotel"
		}
	}
}

Property categories

Get a list of all the property categories.

GET /v1/property/category

Response:

{
	"error": 0,
	"error_text": "",
	"response": {
		"count": 4,
		"items": {
			1: "Standard",
			2: "Hotel",
			3: "Rent-to-rent",
			4: "Managed"
		}
	}
}

Create booking

Create a new booking

POST /v1/booking
channel_reservation_id
string
e.g. RentalsUnited res id
optional
source_reservation_id
string
e.g. booking.com res id
optional
customer_first_name
string
required
customer_last_name
string
required
customer_email
string
required
customer_phone
string
required
booking_channel_id
integer
Get IDs from booking/channel
required
booking_status_id
integer
Get IDs from booking/status
required
booking_source_id
integer
Get IDs from booking/source
required
confirmed
integer
1 or 0
required
property_id
integer
Overrides channel_property_id
optional
channel_property_id
integer
Required if property_id is null
optional
check_in
string
1970-01-01
required
check_out
string
1970-01-01
required
created
string
1970-01-01 00:00:00
required
price
string
0.00
required
guests
integer
required
comments
string
json encoded array
optional
json_data
string
Array of any/all data
required

Response:

{
	"error": 0,
	"error_text": "",
	"response": {
		"booking_id": 1234,
		"checkin": "2017-10-20T00:00:00+00:00",
		"checkout": "2017-10-22T00:00:00+00:00"
	}
}

Update an existing booking

Exactly the same fields as the create call POST /v1/booking, but everything is optional. However, something to lookup must be supplied, e.g. reservation_id, booking_id, check_in & check_out, property_id

PUT /v1/booking
lookup_method
string
Define field to use for lookup. i.e. booking_id, channel_reservation_id, source_reservation_id. Using property_id or channel_property_id also requires both check_in and check_out dates.
required
booking_id
int
BG Booking ID
optional
channel_reservation_id
string
e.g. RentalsUnited res id
optional
source_reservation_id
string
e.g. booking.com res id
optional
customer_first_name
string
optional
customer_last_name
string
optional
customer_email
string
optional
customer_phone
string
optional
booking_channel_id
integer
Get IDs from booking/channel
optional
booking_status_id
integer
Get IDs from booking/status
optional
booking_source_id
integer
Get IDs from booking/source
optional
confirmed
integer
1 or 0
optional
property_id
integer
Overrides channel_property_id
optional
channel_property_id
integer
Required if property_id is null
optional
check_in
string
1970-01-01
optional
check_out
string
1970-01-01
optional
created
string
1970-01-01 00:00:00
optional
price
string
0.00
optional
guests
integer
optional
comments
string
json encoded
array(
array('title1', 'Comment 1'),
array('title2', 'Comment 2'))
optional
json_data
string
Array of any/all data
optional

Response:

{
	"error": 0,
	"error_text": "",
	"response": {
		"booking_id": 1234,
		"checkin": "2017-10-20T00:00:00+00:00",
		"checkout": "2017-10-22T00:00:00+00:00"
	}
}

Booking sources

Get a list of all booking sources

GET /v1/booking/source

Response:

{
	"error": 0,
	"error_text": "",
	"response": {
		"count": 10,
		"items": {
			"1": "title": "Website (Auto)",
			"2": "title": "Phone",
			...
		}
	}
}

Booking statuses

Get a list of all booking statuses

GET /v1/booking/status

Response:

{
	"error": 0,
	"error_text": "",
	"response": {
		"count": 10,
		"items": {
			"1": "title": "Cart / awaiting deposit",
			"2": "title": "Cancelled",
			...
		}
	}
}

Lookup a property by external reference

Get information for a single property. If property is not found, count (int) will be 0.

GET /v1/property/lookup/[booking_source_id]/[reference] Example: Get Property by AirBNB reference
GET /v1/property/lookup/4/242827324
This will map AirBNB ID 242827324 to BrightonGetaways ID 74.

Response:

{
	"error": 0,
	"error_text": "",
	"response": {
		"count": 1,
		"items": {
			"74": {
				"property_id": "74",
				"active": "0",
				"title": "Brighton Apartment",
				"address": "44 Hove Road, Brighton, BN1 3AA",
				"postcode": "BN1 3AA",
				"latitude": "50.822222",
				"longitude": "-0.144444",
				"sleeps": "6",
				"property_type_id": "1",
				"property_type": "Apartment",
				"property_category_id": "1",
				"property_category": "Standard",
				"beds": "4",
				"bedrooms": "2",
				"bathrooms": "1"
			}
		}
	}
}

Booking channels

Get a list of all booking channels

GET /v1/booking/channel

Response:

{
	"error": 0,
	"error_text": "",
	"response": {
		"count": 3,
		"items": {
			"1": "title": "Direct",
			"2": "title": "Staff",
			...
		}
	}
}