Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_QueryParams
oleobject loo_Resp
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
loo_QueryParams = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_QueryParams.ConnectToNewObject("Chilkat.JsonObject")
loo_QueryParams.UpdateString("fetchInstructions","Header")
loo_QueryParams.UpdateString("fetchInstructions","Items")
loo_QueryParams.UpdateString("startDate","2021-04-07")
loo_QueryParams.UpdateString("endDate","2021-04-08")
loo_QueryParams.UpdateInt("children",0)
loo_QueryParams.UpdateInt("adults",1)
loo_QueryParams.UpdateString("hotelId","{{HotelId}}")
loo_QueryParams.UpdateString("packageCode","CHAMP")
loo_Http.SetRequestHeader("x-app-key","{{AppKey}}")
loo_Http.SetRequestHeader("x-hotelid","{{HotelId}}")
// Adds the "Authorization: Bearer <access_token>" header.
loo_Http.AuthToken = "<access_token>"
loo_Resp = loo_Http.QuickRequestParams("GET","https://domain.com/rtp/v0/packages",loo_QueryParams)
if loo_Http.LastMethodSuccess = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_QueryParams
return
end if
Write-Debug string(loo_Resp.StatusCode)
Write-Debug loo_Resp.BodyStr
destroy loo_Resp
destroy loo_Http
destroy loo_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": [
]
}