Chilkat Online Tools

.NET Core C# / ORACLE Hospitality OPERA Cloud REST API Workflows / Get Room types available to add rate schedules

Back to Collection Items

// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.

Chilkat.Http http = new Chilkat.Http();
bool success;

Chilkat.JsonObject queryParams = new Chilkat.JsonObject();
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.AuthToken = "<access_token>";

Chilkat.HttpResponse resp = http.QuickRequestParams("GET","https://domain.com/lov/v1/listOfValues/RoomTypes",queryParams);
if (http.LastMethodSuccess == false) {
    Debug.WriteLine(http.LastErrorText);
    return;
}

Debug.WriteLine(Convert.ToString(resp.StatusCode));
Debug.WriteLine(resp.BodyStr);

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&parameterValue={{RatePlanCode}}&includePseudo=Y&parameterName=HotelCode&parameterValue={{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": [
  ]
}