Back to Collection Items
IncludeFile "CkJsonObject.pb"
IncludeFile "CkHttp.pb"
IncludeFile "CkHttpResponse.pb"
Procedure ChilkatExample()
; This example assumes the Chilkat API to have been previously unlocked.
; See Global Unlock Sample for sample code.
http.i = CkHttp::ckCreate()
If http.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
success.i
; Use this online tool to generate code from sample JSON: Generate Code to Create JSON
; The following JSON is sent in the request body.
; {
; "reservation": {
; "roomId": "{{RoomId}}",
; "ignoreWarnings": true,
; "stopCheckin": false,
; "printRegistration": false
; },
; "fetchReservationInstruction": [
; "ReservationDetail"
; ],
; "includeNotifications": true
; }
json.i = CkJsonObject::ckCreate()
If json.i = 0
Debug "Failed to create object."
ProcedureReturn
EndIf
CkJsonObject::ckUpdateString(json,"reservation.roomId","{{RoomId}}")
CkJsonObject::ckUpdateBool(json,"reservation.ignoreWarnings",1)
CkJsonObject::ckUpdateBool(json,"reservation.stopCheckin",0)
CkJsonObject::ckUpdateBool(json,"reservation.printRegistration",0)
CkJsonObject::ckUpdateString(json,"fetchReservationInstruction[0]","ReservationDetail")
CkJsonObject::ckUpdateBool(json,"includeNotifications",1)
CkHttp::ckSetRequestHeader(http,"Content-Type","application/json")
CkHttp::ckSetRequestHeader(http,"x-app-key","{{AppKey}}")
CkHttp::ckSetRequestHeader(http,"x-hotelid","{{HotelId}}")
; Adds the "Authorization: Bearer <access_token>" header.
CkHttp::setCkAuthToken(http, "<access_token>")
resp.i = CkHttp::ckPostJson3(http,"https://domain.com/fof/v1/hotels/{{HotelId}}/reservations/{{ReservationId}}/checkIns","application/json",json)
If CkHttp::ckLastMethodSuccess(http) = 0
Debug CkHttp::ckLastErrorText(http)
CkHttp::ckDispose(http)
CkJsonObject::ckDispose(json)
ProcedureReturn
EndIf
Debug Str(CkHttpResponse::ckStatusCode(resp))
Debug CkHttpResponse::ckBodyStr(resp)
CkHttpResponse::ckDispose(resp)
CkHttp::ckDispose(http)
CkJsonObject::ckDispose(json)
ProcedureReturn
EndProcedure
Curl Command
curl -X POST
-H "Authorization: Bearer <access_token>"
-H "Content-Type: application/json"
-H "x-app-key: {{AppKey}}"
-H "x-hotelid: {{HotelId}}"
-d '{
"reservation": {
"roomId": "{{RoomId}}",
"ignoreWarnings": true,
"stopCheckin": false,
"printRegistration": false
},
"fetchReservationInstruction": [
"ReservationDetail"
],
"includeNotifications": true
}'
https://domain.com/fof/v1/hotels/{{HotelId}}/reservations/{{ReservationId}}/checkIns
Postman Collection Item JSON
{
"name": "Check-In a Guest",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{Token}}",
"type": "string"
}
]
},
"method": "POST",
"header": [
{
"key": "Content-Type",
"name": "Content-Type",
"type": "text",
"value": "application/json"
},
{
"key": "x-app-key",
"type": "text",
"value": "{{AppKey}}"
},
{
"key": "x-hotelid",
"type": "text",
"value": "{{HotelId}}"
}
],
"body": {
"mode": "raw",
"raw": "{\r\n \"reservation\": {\r\n \"roomId\": \"{{RoomId}}\",\r\n \"ignoreWarnings\": true,\r\n \"stopCheckin\": false,\r\n \"printRegistration\": false\r\n },\r\n \"fetchReservationInstruction\": [\r\n \"ReservationDetail\"\r\n ],\r\n \"includeNotifications\": true\r\n}",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{HostName}}/fof/v1/hotels/{{HotelId}}/reservations/{{ReservationId}}/checkIns",
"host": [
"{{HostName}}"
],
"path": [
"fof",
"v1",
"hotels",
"{{HotelId}}",
"reservations",
"{{ReservationId}}",
"checkIns"
],
"query": [
{
"key": "fetchInstructions",
"value": "Reservation",
"disabled": true
}
]
},
"description": "To check in a guest at the property."
},
"response": [
]
}