Back to Collection Items
#include <CkHttp.h>
#include <CkJsonObject.h>
#include <CkHttpResponse.h>
void ChilkatSample(void)
{
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
CkHttp http;
bool success;
CkJsonObject queryParams;
queryParams.UpdateString("parameterName","RatePlanCode");
queryParams.UpdateString("parameterValue","{{RatePlanCode}}");
queryParams.UpdateString("includePseudo","Y");
queryParams.UpdateString("parameterName","HotelCode");
queryParams.UpdateString("parameterValue","{{HotelId}}");
http.SetRequestHeader("Content-Type","application/json");
http.SetRequestHeader("x-app-key","{{AppKey}}");
http.SetRequestHeader("x-hotelid","{{HotelId}}");
// Adds the "Authorization: Bearer <access_token>" header.
http.put_AuthToken("<access_token>");
CkHttpResponse *resp = http.QuickRequestParams("GET","https://domain.com/lov/v1/listOfValues/RoomTypes",queryParams);
if (http.get_LastMethodSuccess() == false) {
std::cout << http.lastErrorText() << "\r\n";
return;
}
std::cout << resp->get_StatusCode() << "\r\n";
std::cout << resp->bodyStr() << "\r\n";
delete resp;
}
Curl Command
curl -G -d "parameterName=RatePlanCode"
-d "parameterValue=%7B%7BRatePlanCode%7D%7D"
-d "includePseudo=Y"
-d "parameterName=HotelCode"
-d "parameterValue=%7B%7BHotelId%7D%7D"
-H "Authorization: Bearer <access_token>"
-H "Content-Type: application/json"
-H "x-app-key: {{AppKey}}"
-H "x-hotelid: {{HotelId}}"
https://domain.com/lov/v1/listOfValues/RoomTypes
Postman Collection Item JSON
{
"name": "Get Room types available to add rate schedules",
"protocolProfileBehavior": {
"disableBodyPruning": true
},
"request": {
"auth": {
"type": "bearer",
"bearer": [
{
"key": "token",
"value": "{{Token}}",
"type": "string"
}
]
},
"method": "GET",
"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": "",
"options": {
"raw": {
"language": "json"
}
}
},
"url": {
"raw": "{{HostName}}/lov/v1/listOfValues/RoomTypes?parameterName=RatePlanCode¶meterValue={{RatePlanCode}}&includePseudo=Y¶meterName=HotelCode¶meterValue={{HotelId}}",
"host": [
"{{HostName}}"
],
"path": [
"lov",
"v1",
"listOfValues",
"RoomTypes"
],
"query": [
{
"key": "parameterName",
"value": "RatePlanCode"
},
{
"key": "parameterValue",
"value": "{{RatePlanCode}}"
},
{
"key": "includePseudo",
"value": "Y"
},
{
"key": "parameterName",
"value": "HotelCode"
},
{
"key": "parameterValue",
"value": "{{HotelId}}"
}
]
}
},
"response": [
]
}