Back to Collection Items
var
http: HCkHttp;
success: Boolean;
queryParams: HCkJsonObject;
resp: HCkHttpResponse;
begin
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
http := CkHttp_Create();
queryParams := CkJsonObject_Create();
CkJsonObject_UpdateString(queryParams,'fetchInstructions','Header');
CkJsonObject_UpdateString(queryParams,'fetchInstructions','Items');
CkJsonObject_UpdateString(queryParams,'startDate','2021-04-07');
CkJsonObject_UpdateString(queryParams,'endDate','2021-04-08');
CkJsonObject_UpdateInt(queryParams,'children',0);
CkJsonObject_UpdateInt(queryParams,'adults',1);
CkJsonObject_UpdateString(queryParams,'hotelId','{{HotelId}}');
CkJsonObject_UpdateString(queryParams,'packageCode','CHAMP');
CkHttp_SetRequestHeader(http,'x-app-key','{{AppKey}}');
CkHttp_SetRequestHeader(http,'x-hotelid','{{HotelId}}');
// Adds the "Authorization: Bearer <access_token>" header.
CkHttp_putAuthToken(http,'<access_token>');
resp := CkHttp_QuickRequestParams(http,'GET','https://domain.com/rtp/v0/packages',queryParams);
if (CkHttp_getLastMethodSuccess(http) = False) then
begin
Memo1.Lines.Add(CkHttp__lastErrorText(http));
Exit;
end;
Memo1.Lines.Add(IntToStr(CkHttpResponse_getStatusCode(resp)));
Memo1.Lines.Add(CkHttpResponse__bodyStr(resp));
CkHttpResponse_Dispose(resp);
CkHttp_Dispose(http);
CkJsonObject_Dispose(queryParams);
Curl Command
curl -G -d "fetchInstructions=Header"
-d "fetchInstructions=Items"
-d "startDate=2021-04-07"
-d "endDate=2021-04-08"
-d "children=0"
-d "adults=1"
-d "hotelId=%7B%7BHotelId%7D%7D"
-d "packageCode=CHAMP"
-H "Authorization: Bearer <access_token>"
-H "x-hotelid: {{HotelId}}"
-H "x-app-key: {{AppKey}}"
https://domain.com/rtp/v0/packages
Postman Collection Item JSON
{
"name": "Get available packages",
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{Token}}",
"type": "string"
}
]
},
"method": "GET",
"header": [
{
"key": "x-hotelid",
"type": "text",
"value": "{{HotelId}}"
},
{
"key": "x-app-key",
"value": "{{AppKey}}",
"type": "text"
}
],
"url": {
"raw": "{{HostName}}/rtp/v0/packages?fetchInstructions=Header&fetchInstructions=Items&startDate=2021-04-07&endDate=2021-04-08&children=0&adults=1&hotelId={{HotelId}}&packageCode=CHAMP",
"host": [
"{{HostName}}"
],
"path": [
"rtp",
"v0",
"packages"
],
"query": [
{
"key": "includeGroup",
"value": "true",
"disabled": true
},
{
"key": "sellSeparate",
"value": "true",
"disabled": true
},
{
"key": "fetchInstructions",
"value": "Header"
},
{
"key": "fetchInstructions",
"value": "CalculatedPrice",
"disabled": true
},
{
"key": "fetchInstructions",
"value": "Items"
},
{
"key": "startDate",
"value": "2021-04-07"
},
{
"key": "endDate",
"value": "2021-04-08"
},
{
"key": "children",
"value": "0"
},
{
"key": "adults",
"value": "1"
},
{
"key": "hotelId",
"value": "{{HotelId}}"
},
{
"key": "ticketPostingRhythm",
"value": "false",
"disabled": true
},
{
"key": "packageCode",
"value": "CHAMP"
},
{
"key": "descriptionWildCard",
"value": "",
"disabled": true
}
]
}
},
"response": [
]
}