Back to Collection Items
var os = require('os');
if (os.platform() == 'win32') {
if (os.arch() == 'ia32') {
var chilkat = require('@chilkat/ck-node21-win-ia32');
} else {
var chilkat = require('@chilkat/ck-node21-win64');
}
} else if (os.platform() == 'linux') {
if (os.arch() == 'arm') {
var chilkat = require('@chilkat/ck-node21-arm');
} else if (os.arch() == 'x86') {
var chilkat = require('@chilkat/ck-node21-linux32');
} else {
var chilkat = require('@chilkat/ck-node21-linux64');
}
} else if (os.platform() == 'darwin') {
if (os.arch() == 'arm64') {
var chilkat = require('@chilkat/ck-node21-mac-m1');
} else {
var chilkat = require('@chilkat/ck-node21-macosx');
}
}
function chilkatExample() {
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
var http = new chilkat.Http();
var success;
var queryParams = new chilkat.JsonObject();
queryParams.UpdateString("fetchInstructions","Header");
queryParams.UpdateString("fetchInstructions","Items");
queryParams.UpdateString("startDate","2021-04-07");
queryParams.UpdateString("endDate","2021-04-08");
queryParams.UpdateInt("children",0);
queryParams.UpdateInt("adults",1);
queryParams.UpdateString("hotelId","{{HotelId}}");
queryParams.UpdateString("packageCode","CHAMP");
http.SetRequestHeader("x-app-key","{{AppKey}}");
http.SetRequestHeader("x-hotelid","{{HotelId}}");
// Adds the "Authorization: Bearer <access_token>" header.
http.AuthToken = "<access_token>";
// resp: HttpResponse
var resp = http.QuickRequestParams("GET","https://domain.com/rtp/v0/packages",queryParams);
if (http.LastMethodSuccess == false) {
console.log(http.LastErrorText);
return;
}
console.log(resp.StatusCode);
console.log(resp.BodyStr);
}
chilkatExample();
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": [
]
}