Documentatie API - PMS
Get check in reservations list
- URL: https://api.pynbooking.com/reservation/list/
Response format: : JSON
Important Note!
For security issues you need a special API-Key.
Please insert this Key into the header. If your API-Key is ABCDEFGH Your header should look like: ‘Api-Key: ABCDEFGH’
GET Request
Response:
[{"id":"917","checkInDate":"2020-05-06","checkOutDate":"2020-05-08","reservationType":"1","roomName":"110","status":"Confirmata","checkIn":true,"guestId":"141","guestName":"Andrei Ionut","guestPhone":"","guests":[{"guestId":"141","guestName":"Andrei Ionut","guestPhone":""},{"guestId":"121","guestName":"Snow Jon","guestPhone":""},{"guestId":"133","guestName":"Mihai Adrian","guestPhone":""}]},{"id":"961","checkInDate":"2020-05-07","checkOutDate":"2020-05-08","reservationType":1,"roomName":"401","status":"Confirmata","checkIn":true,"guestId":"191","guestName":"Popescu Dorel","guestPhone":"","guests":[{"guestId":"191","guestName":"Popescu Dorel","guestPhone":""}]}]
Search room reservations
- URL: https://api.pynbooking.com/reservation/roomSearch/
Response format: : JSON
Important Note!
For security issues you need a special API-Key.
Please insert this Key into the header. If your API-Key is ABCDEFGH Your header should look like: ‘Api-Key: ABCDEFGH’
POST Request parameters
roomNo ( ex. "401")
Response:
[{"id":"961","checkInDate":"2020-05-07","checkOutDate":"2020-05-08","reservationType":1,"roomName":"401","status":"Confirmata","checkIn":true,"guestId":"191","guestName":"Popescu Dorel","guestPhone":"","guests":[{"guestId":"191","guestName":"Popescu Dorel","guestPhone":""}]}]
Get search reservations list
- URL: https://api.pynbooking.com/reservation/search/
Response format: : JSON
Important Note!
For security issues you need a special API-Key.
Please insert this Key into the header. If your API-Key is ABCDEFGH Your header should look like: ‘Api-Key: ABCDEFGH’
POST Request parameters
date (date format ex. "2019-08-30")
Response:
[{"id":"958","checkInDate":"2020-05-08","checkOutDate":"2020-05-09","reservationType":"1","roomName":"104","status":"Confirmata","checkIn":false,"guestId":"141","guestName":"Snow Jon","guestPhone":"","guests":[{"guestId":"141","guestName":"Snow Jon","guestPhone":""}]},{"id":"917","checkInDate":"2020-05-06","checkOutDate":"2020-05-08","reservationType":"1","roomName":"110","status":"Confirmata","checkIn":true,"guestId":"141","guestName":"Andrei Ionut","guestPhone":"","guests":[{"guestId":"141","guestName":"Andrei Ionut","guestPhone":""},{"guestId":"121","guestName":"Snow Jon","guestPhone":""},{"guestId":"133","guestName":"Mihai Adrian","guestPhone":""}]},{"id":"961","checkInDate":"2020-05-07","checkOutDate":"2020-05-08","reservationType":1,"roomName":"401","status":"Confirmata","checkIn":true,"guestId":"191","guestName":"Popescu Dorel","guestPhone":"","guests":[{"guestId":"191","guestName":"Popescu Dorel","guestPhone":""}]}]
Add a product to reservation folio
- URL: https://api.pynbooking.com/reservation/addFolioItem/
Response format: : JSON
Important Note!
For security issues you need a special API-Key.
Please insert this Key into the header. If your API-Key is ABCDEFGH Your header should look like: ‘Api-Key: ABCDEFGH’
POST Request parameters
id (reservation id)
itemName (char 255)
vat
quantity
price (unit price)
guestId *not required
apiSource *not required
Response:
{
"folioItemId":105586,"status":"ok"
}
Add a products to reservation folio
- URL: https://api.pynbooking.com/reservation/addFolioItems/
Response format: : JSON
Important Note!
For security issues you need a special API-Key.
Please insert this Key into the header. If your API-Key is ABCDEFGH Your header should look like: ‘Api-Key: ABCDEFGH’
POST Request parameters
id (reservation id)
items (array)
itemName (char 255)
vat
quantity
price (unit price)
guestId *not required
apiSource *not required
Response:
{"folioItems":{"1":3938,"2":3939},"status":"ok"}
Raport plan mese
- URL: https://api.pynbooking.com/reservation/reportMealPlan/
Response format: : JSON
IImportant Note!
For security issues you need a special API-Key.
Please insert this Key into the header. If your API-Key is ABCDEFGH Your header should look like: ‘Api-Key: ABCDEFGH’
POST Request parameters
date (date format ex. "2019-08-30")
meal ('breakfast','lunch','dinner')
Response:
{"status":"ok","results":[{"id":"891","roomName":"101","checkInDate":"2020-05-11","checkOutDate":"2020-05-16","nights":"5","mealPlan":"Mic dejun","adultNo":"2","childNo":"0","guestName":"J. Snow","barcodes":[{"barcode":"33333","poolAccess":"1"},{"barcode":"42342423422","poolAccess":"0"},{"barcode":"414124","poolAccess":"0"}]},{"id":"890","roomName":"110","checkInDate":"2020-05-12","checkOutDate":"2020-05-16","nights":"4","mealPlan":"Mic dejun","adultNo":"2","childNo":"0","guestName":"J. Snow","barcodes":[]}]}
Raport plan mese pe o anumita perioada
- URL: https://api.pynbooking.com/reservation/reportMealPlanPeriod/
Response format: : JSON
Important Note!
For security issues you need a special API-Key.
Please insert this Key into the header. If your API-Key is ABCDEFGH Your header should look like: ‘Api-Key: ABCDEFGH’
POST Request parameters
date (date format ex. "2019-08-30")
days (from 1-30)
Response:
{"status":"ok","results":[{"id":"891","roomName":"101","checkInDate":"2020-05-11","checkOutDate":"2020-05-16","nights":"5","mealPlan":"Mic dejun","adultNo":"2","childNo":"0","guestFirstName":"Jon","guestLastName":"Snow","guestPhone":"+400745000000","guestEmail":"ionuti85@gmail.com","barcodes":[{"barcode":"33333","poolAccess":"1"},{"barcode":"42342423422","poolAccess":"0"},{"barcode":"414124","poolAccess":"0"}]},{"id":"890","roomName":"110","checkInDate":"2020-05-12","checkOutDate":"2020-05-16","nights":"4","mealPlan":"Mic dejun","adultNo":"2","childNo":"0","guestFirstName":"Jon","guestLastName":"Snow","guestPhone":"+400745000000","guestEmail":"ionuti85@gmail.com","barcodes":[]},{"id":"960","roomName":"106","checkInDate":"2020-05-15","checkOutDate":"2020-05-16","nights":"1","mealPlan":"Mic dejun","adultNo":"2","childNo":"1","guestFirstName":"Jon","guestLastName":"Snow","guestPhone":"+400745000000","guestEmail":"ionuti85@gmail.com","barcodes":[]},{"id":"885","roomName":"110","checkInDate":"2020-05-18","checkOutDate":"2020-05-25","nights":"7","mealPlan":"Mic dejun","adultNo":"2","childNo":"0","guestFirstName":"Jon","guestLastName":"Snow","guestPhone":"+400745000000","guestEmail":"ionuti85@gmail.com","barcodes":[]}]}
Get email list
- URL: https://api.pynbooking.com/marketing/emailList/
Response format: : JSON
Important Note!
For security issues you need a special API-Key.
Please insert this Key into the header. If your API-Key is ABCDEFGH Your header should look like: ‘Api-Key: ABCDEFGH’
POST Request parameters
status ( "","inhouse","arrival","departure")
page (ex 1)
perPage(max 5000, default 1000)
date (ex. 2022-03-01, doar pentru status arrival sau departure)
Response:
{"status":"ok","results":[{"firstName":"Test","lastName":"Test","email":"mail@test.com,"country":"RO","dateOfBirth":"1983-08-08"},{"firstName":"Jon","lastName":"Snow","email":"test@gmail.com","country":"RO","dateOfBirth":"1985-04-09"},{"firstName":"Jon","lastName":"Snow","email":"test@gmail.com","country":"RO","dateOfBirth":""}]}
Get phone list
- URL: https://api.pynbooking.com/marketing/phoneList/
Response format: : JSON
Important Note!
For security issues you need a special API-Key.
Please insert this Key into the header. If your API-Key is ABCDEFGH Your header should look like: ‘Api-Key: ABCDEFGH’
POST Request parameters
status ( "","inhouse","arrival","departure")
page (ex 1)
perPage(max 5000, default 1000)
date (ex. 2022-03-01, doar pentru status arrival sau departure)
Response:
{"status":"ok","results":[{"firstName":"Jon","lastName":"Snow","phone":"745000000","phone_country_code":"+40","country":"RO","dateOfBirth":"1983-08-08"},{"firstName":"Test","lastName":"Test","phone":"745000000","phone_country_code":"+40","country":"RO","dateOfBirth":"1987-07-09"}]}
Get Invoice list
- URL: https://api.pynbooking.com/invoice/list/
Response format: : JSON
Important Note!
For security issues you need a special API-Key.
Please insert this Key into the header. If your API-Key is ABCDEFGH Your header should look like: ‘Api-Key: ABCDEFGH’
POST Request parameters
startDate(date format ex. "2019-08-01")
endDate (date format ex. "2019-08-31" - max number of days 31)
Response:
{"status":"ok","results":[{"number":"PYN3935","date":"2022-05-14","currency":"RON","supplier":{"name":"TEST SRL","id":"RO4444444","sec_vat_id":"J40\/3490\/21.03.2000","country":"RO"},"client":{"name":"Snow Jon","type":"PF","id":"1850409100000","city":"Buzau","address":"Bld. Unirii, Bl C2, ap 9,","country":"RO","pms_id":"375"},"payment_method":"Virament","items":[{"item_name":"Avans cazare","item_type":"Avans","qty":"1","unit_price":"476.19","price":500,"vat":"5","net_price":"476.19","vat_price":"23.81","extra_details":{"from":"booking","book_id":"1937","arrival_date":"2022-05-13","departure_date":"2022-05-15","post_date":"2022-05-13\/2022-05-15"}}],"subtotal":[{"vat":5,"price":"500.00","net_price":"476.19","vat_price":"23.81"}],"total":{"price":"500.00","net_price":"476.19","vat_price":"23.81"}},
Atentie!
Pentru a putea trimite numele complet si telefonul clientului avem nevoie de numele firmei ce prelucreaza date cu caracter personal precum si ip de la care se vor face requesturile.
- https://api.pynbooking.com/reservation/list/
Returneaza toate rezervarile check-in din sistem pentru ziua curenta.
Functia se foloseste pentru a vedea rezervarile cazate.
- https://api.pynbooking.com/reservation/roomSearch/
Returneaza rezervarea check-in din sistem pentru ziua curenta si camera specificata.
Functia se foloseste pentru a vedea rezervarea cazata dintr-o anumita camera.
- https://api.pynbooking.com/reservation/search/
Returneaza toate rezervarile din ziua dorita($date) fara rezervarile checkout. Data trebuie sa fie mai mare sau egala cu ziua curenta
Se foloseste pentru a vedea totate rezervarile dintr-o zi anume.
Cautarea dupa numarul camerei nu este concludenta pentru rezervarile viitoare.
Cautarea pe numarul camerei (nume client , telefon ) o puteti face intern din rezervarile returnate.
Nu exista paginare pentru rezultat.
Daca raspunsul contine campul "status" requestul nu este valid puteti vedea mai multe detalii in campul "detail".
Exemplu php
class PynBooking
{
private $endpoint = null;
private $key = null;
function __construct($apiEndpoint=null, $apiKey=null)
{
global $apiUrl,$key;
if(!isset($apiKey))
$apiKey = $key;
if(!isset($apiEndpoint))
$apiEndpoint = $apiUrl;
$this->endpoint = $apiEndpoint;
$this->key = $apiKey;
}
public function listReservation()
{
$headers[] = "Api-Key: ".$this->key;
return $this->callHTTP2Json($this->endpoint."/reservation/list/",null,"GET",$headers);
}
public function searchReservation($data)
{
$headers[] = "Api-Key: ".$this->key;
return $this->callHTTP2Json($this->endpoint."/reservation/search/",$data,"POST",$headers);
}
public function roomSearchReservation($data)
{
$headers[] = "Api-Key: ".$this->key;
return $this->callHTTP2Json($this->endpoint."/reservation/roomSearch/",$data,"POST",$headers);
}
public function reportMealPlanReservation($data)
{
$headers[] = "Api-Key: ".$this->key;
return $this->callHTTP2Json($this->endpoint."/reservation/reportMealPlan/",$data,"POST",$headers);
}
public function reportMealPlanPeriodReservation($data)
{
$headers[] = "Api-Key: ".$this->key;
return $this->callHTTP2Json($this->endpoint."/reservation/reportMealPlanPeriod/",$data,"POST",$headers);
}
public function addFolioItemReservation($data)
{
$headers[] = "Api-Key: ".$this->key;
return $this->callHTTP2Json($this->endpoint."/reservation/addFolioItem/",$data,"POST",$headers);
}
public function addFolioItemsReservation($data)
{
$headers[] = "Api-Key: ".$this->key;
return $this->callHTTP2Json($this->endpoint."/reservation/addFolioItems/",$data,"POST",$headers);
}
private function callHTTP2Json($url,$postparams=null,$method=null,$headers=null,$user=null,$password=null)
{
return json_decode($this->callRemote($url,$postparams,$method,$headers,$user,$password),true);
}
private function callJson2Json($url,$postparams=null,$method=null,$headers=null,$user=null,$password=null)
{
$postparams = json_encode($postparams);
if($headers==null)
$headers = array();
if(is_string($headers))
$headers = array($headers);
$headers[] = "Content-type: application/json";
return json_decode($this->callRemote($url,$postparams,$method,$headers,$user,$password),true);
}
private function callRemote($url,$postparams=null,$method=null,$headers=null,$user=null,$password=null)
{
if(function_exists('curl_version'))
{
return $this->curlRemote($url,$postparams,$method,$headers,$user,$password);
}
else
{
return $this->httpRemote($url,$postparams,$method,$headers,$user,$password);
}
}
private function httpRemote($url,$postparams=null,$method=null,$headers=null,$user=null,$password=null)
{
if($method == null)
{
if($postparams==null)
$method = "GET";
else
$method = "POST";
}
if($headers == null)
{
$headers = array();
}
elseif(is_string($headers))
{
$headers = array($headers);
}
if($method=="POST" && is_array($postparams))
{
$headers[] = "Content-type: application/x-www-form-urlencoded";
$postparams = http_build_query($postparams);
}
if($user!=null && $password != null)
{
$headers[] = "Authorization: Basic ".base64_encode($user . ":" . $password);
}
$context = stream_context_create(array(
"http"=>array(
"method" => $method,
"headers" => $headers,
"content" => $postparams
)
));
return file_get_contents($url,false,$context);
}
private function curlRemote($url,$postparams=null,$method=null,$headers=null,$user=null,$password=null)
{
// if post params = array and method = null - post
// if post params = null and method = null - get
if($method == null)
{
if($postparams==null)
$method = "GET";
else
$method = "POST";
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
if($method=="POST")
{
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS,http_build_query($postparams));// why? because curl is a f r3tard!
}
if(is_array($headers) && count($headers) > 0)
{
curl_setopt($ch, CURLOPT_HTTPHEADER,$headers);
}
if($user!=null && $password != null)
{
curl_setopt($ch, CURLOPT_USERPWD, $user . ":" . $password);
}
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$output = curl_exec($ch);
curl_close($ch);
return $output;
}
}
$apiEndPoint='https://api.pynbooking.com';
$apiKey=''; cheia pe care o primiti in momentul activari modulului
//1. list reservation
$objPynBooking=new PynBooking($apiEndPoint,$apiKey);
$reservations=$objPynBooking->listReservation();
//2 .room search reservation
$data=array();
$data['roomNo']='401';
$objPynBooking=new PynBooking($apiEndPoint,$apiKey);
$reservations=$objPynBooking->roomSearchReservation($data);
//3. search reservation
$data=array();
$data['date']='2020-07-01';
$objPynBooking=new PynBooking($apiEndPoint,$apiKey);
$reservations=$objPynBooking->searchReservation($data);
//4. add folio item
$data=array();
$data['id']='598';
$data['itemName']='Coca Cola';
$data['price']='5.50';
$data['vat']='5';
$data['quantity']='3';
$data['guestId']='121';
$data['apiSource']='BAR';
$objPynBooking=new PynBooking($apiEndPoint,$apiKey);
$response=$objPynBooking->addFolioItemReservation($data);
//5. add folio items
$data=array();
$data['id']='598';
$data['items']=array();
$data['items'][0]['itemName']='Test 5%';
$data['items'][0]['price']='15.50';
$data['items'][0]['vat']='5';
$data['items'][0]['quantity']='1';
$data['items'][0]['guestId']='121';
$data['items'][0]['apiSource']='BAR';
$data['items'][1]['itemName']='Test 9%';
$data['items'][1]['price']='20'.00;
$data['items'][1]['vat']='9';
$data['items'][1]['quantity']='3';
$data['items'][1]['guestId']='125';
$data['items'][1]['apiSource']='BUCATARIE';
$objPynBooking=new PynBooking($apiEndPoint,$apiKey);
$response=$objPynBooking->addFolioItemsReservation($data);
//6. Report Meal plan
$data=array();
$data['date']='2020-05-13';
$data['meal']='breakfast';
$objPynBooking=new PynBooking($apiEndPoint,$apiKey);
$response=$objPynBooking->reportMealPlanReservation($data);
//7. Report Meal plan on a specific perioad
$data=array();
$data['date']='2020-05-13';
$data['days']='14';
$objPynBooking=new PynBooking($apiEndPoint,$apiKey);
$response=$objPynBooking->reportMealPlanPeriodReservation($data);
Spor la integrare!