There are many cases where you will need to verify a quest's information by asking for the room number and some additional info (for instance last name or booking reference). A typical use-case is in verifying a guest for a WiFi provider.
There are a number of easy ways to achieve this with the Impala API (and a lot that you can cache) the below step-by-step guide will provide you with the most straightforward way to do this.
Retrieving all of the rooms in the hotel
Finding the relevant booking in that room
Retrieving all of the rooms in the hotel
First we'll call the GET /area
endpoint to retrieve the rooms in the hotel and their corresponding Impala ID:
We'll then look at the response for the room we're looking for (101):
{
"data":[
{
"id":"5b436d9ab2b16a43c15ff1e3",
"name":"101",
"areaTypeId":"5b436d9a33c1403858d9700c",
"status":"CLEAN",
"description":null,
"parentAreaId":null,
"_extras":{
},
"_meta":{
"lastRefreshedAt":1554463239
}
}
]
}
Find the relevant booking in that room
We'll use the GET /booking
endpoint to retrieve the current stay in that room:
We'll then inspect the data we've returned (NB: we've removed some fields from the response to make it clearer):
{
"data":[
{
"id":"5b436d9bffc35bae7e48f922",
"reference":"B-JW4LG0C",
"bookingSetId":"5b436d9b484c39d9f0959a66",
"start":1531145626,
"end":1531232026,
"areaId":"5b436d9ab2b16a43c15ff1e3",
"requestedAreaTypeId":"5b436d9a33c1403858d9700c",
"adultCount":2,
"childCount":2,
"infantCount":null,
"contact":{
"id":"5b436d9bb714f0187e42c7a6",
"type":"guest"
},
"guestIds":[
"5b436d9bb714f0187e42c7a6"
],
"allocationId":null,
"_meta":{
"lastRefreshedAt":1554463217
}
}
]
}
Retrieving the Guest Data
Now that we have the guest that's staying in that room 5b436d9bb714f0187e42c7a6
we can find that guests information using the GET /guest
endpoint:
Inspecting the output we can ensure that the guest's last name is indeed Parton. We can now validate that the guest is indeed staying in the suggested room.
{
"data":{
"id":"5b436d9bb714f0187e42c7a6",
"title":"Ms.",
"firstName":"Dolly",
"middleName":"",
"lastName":"Parton",
"sexCode":1,
"emails":[
"dolly.parton@yahoo.com"
],
"phoneNumbers":[
"1-915-595-1652 x0345"
],
"languageCode":"khm",
"nationalityCode":"MNG",
"dateOfBirth":null,
"placeOfBirth":null,
"loyaltyPrograms":[
],
"notes":null,
"classifications":[
],
"addresses":[
{
"line1":"2647 Hermiston Valleys",
"line2":null,
"city":"North Beverly",
"postalCode":"28332",
"countryCode":"IDN",
"_extras":{
"state":"New Jersey"
}
}
],
"documents":[
{
"type":"passport",
"number":"oom6kj3r8wyrpla3"
}
],
"createdAt":1531145628,
"updatedAt":1531145628,
"optIns":null,
"contactBy":null,
"_extras":{
},
"_meta":{
"lastRefreshedAt":1554463218
}
},
"_meta":{
"pms":"IMPALA_PMS"
}
}