API V2 Documentation - AbracadaRoom

Examples

The following examples are written in PHP.

Guzzle library usage

Via the username / password combination

$client = new GuzzleClient();
$result = $client->request('GET', 'https://vacation.unicstay.com/api/v1/abcd/v2/accommodations', [
  'auth' => ['username', 'password'],
]);
$response = json_decode($result->getBody()->getContents());

or

$client = new GuzzleClient();
$result = $client->request('GET', 'https://vacation.unicstay.com/api/v1/abcd/v2/accommodations', [
  'headers' => [
    'Authorization' => 'Basic ' . base64_encode('username:password'),
  ],
]);
$response = json_decode($result->getBody()->getContents());

Via the authentication token

$client = new GuzzleClient();
$result = $client->request('GET', 'https://vacation.unicstay.com/api/v1/abcd/v2/accommodations', [
  'headers' => [
    'Authorization' => 'Bearer your_api_token',
  ],
]);
$response = json_decode($result->getBody()->getContents());

cURL usage

Via the username / password combination

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://vacation.unicstay.com/api/v1/abcd/v2/accommodations');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'Authorization: Basic ' . base64_encode('username:password'),
]);
$result = curl_exec($ch);
curl_close($ch);
$response = json_decode($result);

Via the authentication token

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://vacation.unicstay.com/api/v1/abcd/v2/accommodations');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
  'Authorization: Bearer your_api_token',
]);
$result = curl_exec($ch);
curl_close($ch);
$response = json_decode($result);