The following examples are written in PHP.
$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());
$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());
$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);
$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);