Chilkat Online Tools

unicodeC / ORACLE Hospitality OPERA Cloud REST API Workflows / Search Function Space Availability

Back to Collection Items

#include <C_CkHttpW.h>
#include <C_CkJsonObjectW.h>
#include <C_CkHttpResponseW.h>

void ChilkatSample(void)
    {
    HCkHttpW http;
    BOOL success;
    HCkJsonObjectW queryParams;
    HCkHttpResponseW resp;

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

    http = CkHttpW_Create();

    queryParams = CkJsonObjectW_Create();
    CkJsonObjectW_UpdateString(queryParams,L"parameterName",L"HotelCode");
    CkJsonObjectW_UpdateString(queryParams,L"parameterValue",L"{{HotelId}}");
    CkJsonObjectW_UpdateString(queryParams,L"parameterName",L"EventType");
    CkJsonObjectW_UpdateString(queryParams,L"parameterValue",L"BRKFT");
    CkJsonObjectW_UpdateString(queryParams,L"parameterName",L"Event_Start");
    CkJsonObjectW_UpdateString(queryParams,L"parameterValue",L"2021-06-09 08:00:00.0");
    CkJsonObjectW_UpdateString(queryParams,L"parameterName",L"Event_End");
    CkJsonObjectW_UpdateString(queryParams,L"parameterValue",L"2010-06-09 09:00:00.0");
    CkJsonObjectW_UpdateString(queryParams,L"includeInactiveFlag",L"false");

    CkHttpW_SetRequestHeader(http,L"x-app-key",L"{{AppKey}}");
    CkHttpW_SetRequestHeader(http,L"x-hotelid",L"{{HotelId}}");
    // Adds the "Authorization: Bearer <access_token>" header.
    CkHttpW_putAuthToken(http,L"<access_token>");

    resp = CkHttpW_QuickRequestParams(http,L"GET",L"https://domain.com/lov/v1/listOfValues/AvailableSpaces",queryParams);
    if (CkHttpW_getLastMethodSuccess(http) == FALSE) {
        wprintf(L"%s\n",CkHttpW_lastErrorText(http));
        CkHttpW_Dispose(http);
        CkJsonObjectW_Dispose(queryParams);
        return;
    }

    wprintf(L"%d\n",CkHttpResponseW_getStatusCode(resp));
    wprintf(L"%s\n",CkHttpResponseW_bodyStr(resp));
    CkHttpResponseW_Dispose(resp);


    CkHttpW_Dispose(http);
    CkJsonObjectW_Dispose(queryParams);

    }

Curl Command

curl -G -d "parameterName=HotelCode"
	-d "parameterValue=%7B%7BHotelId%7D%7D"
	-d "parameterName=EventType"
	-d "parameterValue=BRKFT"
	-d "parameterName=Event_Start"
	-d "parameterValue=2021-06-09%2008%3A00%3A00.0"
	-d "parameterName=Event_End"
	-d "parameterValue=2010-06-09%2009%3A00%3A00.0"
	-d "includeInactiveFlag=false"
	-H "Authorization: Bearer <access_token>"
	-H "x-app-key: {{AppKey}}"
	-H "x-hotelid: {{HotelId}}"
https://domain.com/lov/v1/listOfValues/AvailableSpaces

Postman Collection Item JSON

{
  "name": "Search Function Space Availability",
  "request": {
    "auth": {
      "type": "bearer",
      "bearer": [
        {
          "key": "token",
          "value": "{{Token}}",
          "type": "string"
        }
      ]
    },
    "method": "GET",
    "header": [
      {
        "key": "x-app-key",
        "type": "text",
        "value": "{{AppKey}}"
      },
      {
        "key": "x-hotelid",
        "type": "text",
        "value": "{{HotelId}}"
      }
    ],
    "url": {
      "raw": "{{HostName}}/lov/v1/listOfValues/AvailableSpaces?parameterName=HotelCode&parameterValue={{HotelId}}&parameterName=EventType&parameterValue=BRKFT&parameterName=Event_Start&parameterValue=2021-06-09+08:00:00.0&parameterName=Event_End&parameterValue=2010-06-09+09:00:00.0&includeInactiveFlag=false",
      "host": [
        "{{HostName}}"
      ],
      "path": [
        "lov",
        "v1",
        "listOfValues",
        "AvailableSpaces"
      ],
      "query": [
        {
          "key": "parameterName",
          "value": "HotelCode"
        },
        {
          "key": "parameterValue",
          "value": "{{HotelId}}"
        },
        {
          "key": "parameterName",
          "value": "EventType"
        },
        {
          "key": "parameterValue",
          "value": "BRKFT",
          "description": "Event Type Code found from getEventTypes"
        },
        {
          "key": "parameterName",
          "value": "Event_Start"
        },
        {
          "key": "parameterValue",
          "value": "2021-06-09+08:00:00.0"
        },
        {
          "key": "parameterName",
          "value": "Event_End"
        },
        {
          "key": "parameterValue",
          "value": "2010-06-09+09:00:00.0"
        },
        {
          "key": "includeInactiveFlag",
          "value": "false"
        }
      ]
    }
  },
  "response": [
  ]
}