Chilkat Online Tools

Node.js / ORACLE Hospitality OPERA Cloud REST API Workflows / Search for a Reservation

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("text","smith");

    http.SetRequestHeader("Content-Type","application/json");
    http.SetRequestHeader("x-hotelid","{{HotelId}}");
    // Adds the "Authorization: Bearer <access_token>" header.
    http.AuthToken = "<access_token>";
    http.SetRequestHeader("x-app-key","{{AppKey}}");

    // resp: HttpResponse
    var resp = http.QuickRequestParams("GET","https://domain.com/rsv/v1/hotels/{{HotelId}}/reservations",queryParams);
    if (http.LastMethodSuccess == false) {
        console.log(http.LastErrorText);
        return;
    }

    console.log(resp.StatusCode);
    console.log(resp.BodyStr);


}

chilkatExample();

Curl Command

curl -G -d "text=smith"
	-H "Authorization: Bearer <access_token>"
	-H "Content-Type: application/json"
	-H "x-hotelid: {{HotelId}}"
	-H "x-app-key: {{AppKey}}"
https://domain.com/rsv/v1/hotels/{{HotelId}}/reservations

Postman Collection Item JSON

{
  "name": "Search for a Reservation",
  "protocolProfileBehavior": {
    "disableBodyPruning": true
  },
  "request": {
    "auth": {
      "type": "bearer",
      "bearer": [
        {
          "key": "token",
          "value": "{{Token}}",
          "type": "string"
        }
      ]
    },
    "method": "GET",
    "header": [
      {
        "key": "Content-Type",
        "name": "Content-Type",
        "value": "application/json",
        "type": "text"
      },
      {
        "key": "x-hotelid",
        "value": "{{HotelId}}",
        "type": "text"
      },
      {
        "key": "x-app-key",
        "value": "{{AppKey}}",
        "type": "text"
      }
    ],
    "body": {
      "mode": "raw",
      "raw": "",
      "options": {
        "raw": {
          "language": "json"
        }
      }
    },
    "url": {
      "raw": "{{HostName}}/rsv/v1/hotels/{{HotelId}}/reservations?text=smith",
      "host": [
        "{{HostName}}"
      ],
      "path": [
        "rsv",
        "v1",
        "hotels",
        "{{HotelId}}",
        "reservations"
      ],
      "query": [
        {
          "key": "surname",
          "value": "",
          "disabled": true
        },
        {
          "key": "givenName",
          "value": "BILLY",
          "disabled": true
        },
        {
          "key": "arrivalEndDate",
          "value": "2021-11-20",
          "disabled": true
        },
        {
          "key": "arrivalStartDate",
          "value": "",
          "disabled": true
        },
        {
          "key": "departureEndDate",
          "value": "2021-08-19",
          "disabled": true
        },
        {
          "key": "departureStartDate",
          "value": "2021-08-10",
          "disabled": true
        },
        {
          "key": "expectedArrivalEndTime",
          "value": "2021-08-16T21:00:00",
          "disabled": true
        },
        {
          "key": "expectedArrivalStartTime",
          "value": "21:00",
          "disabled": true
        },
        {
          "key": "expectedReturnEndTime",
          "value": "23:00",
          "disabled": true
        },
        {
          "key": "expectedReturnStartTime",
          "value": "",
          "disabled": true
        },
        {
          "key": "companyNames",
          "value": "",
          "disabled": true
        },
        {
          "key": "travelAgentIds",
          "value": "",
          "disabled": true
        },
        {
          "key": "profileIds",
          "value": "6412790000",
          "disabled": true
        },
        {
          "key": "membershipCardNumber",
          "value": "123456",
          "disabled": true
        },
        {
          "key": "membershipLevels",
          "value": "GOLD",
          "disabled": true
        },
        {
          "key": "membershipTypes",
          "value": "OZ",
          "disabled": true
        },
        {
          "key": "anyVIPStatus",
          "value": "",
          "disabled": true
        },
        {
          "key": "vipCodes",
          "value": "CEL",
          "disabled": true
        },
        {
          "key": "guaranteeCode",
          "value": "4PMHOLD",
          "disabled": true
        },
        {
          "key": "paymentMethod",
          "value": "CA",
          "disabled": true
        },
        {
          "key": "createdBy",
          "value": "44654",
          "disabled": true
        },
        {
          "key": "cancelledOn",
          "value": "",
          "disabled": true
        },
        {
          "key": "ratePlanCodes",
          "value": "",
          "disabled": true
        },
        {
          "key": "sourceCodes",
          "value": "COLD",
          "disabled": true
        },
        {
          "key": "marketCodes",
          "value": "DIR",
          "disabled": true
        },
        {
          "key": "excludeBlockReservations",
          "value": "false",
          "disabled": true
        },
        {
          "key": "blockName",
          "value": "ORACLE",
          "disabled": true
        },
        {
          "key": "blockIds",
          "value": "",
          "disabled": true
        },
        {
          "key": "blockCodes",
          "value": "",
          "disabled": true
        },
        {
          "key": "customReference",
          "value": "",
          "disabled": true
        },
        {
          "key": "recordLocator",
          "value": "CA3QMBCISO",
          "disabled": true
        },
        {
          "key": "roomAssignedOnly",
          "value": " true",
          "disabled": true
        },
        {
          "key": "roomUnassignedOnly",
          "value": " false",
          "disabled": true
        },
        {
          "key": "housekeepingRoomStatuses",
          "value": "Inspected",
          "disabled": true
        },
        {
          "key": "roomClasses",
          "value": "",
          "disabled": true
        },
        {
          "key": "communication",
          "value": "",
          "disabled": true
        },
        {
          "key": "fetchInstructions",
          "value": "",
          "disabled": true
        },
        {
          "key": "allowPreRegistration",
          "value": "",
          "disabled": true
        },
        {
          "key": "actualDepartures",
          "value": "",
          "disabled": true
        },
        {
          "key": "complimentaryReservations",
          "value": "",
          "disabled": true
        },
        {
          "key": "dayUse",
          "value": "",
          "disabled": true
        },
        {
          "key": "earlyDepartures",
          "value": "",
          "disabled": true
        },
        {
          "key": "expectedArrivals",
          "value": "",
          "disabled": true
        },
        {
          "key": "expectedDepartures",
          "value": "",
          "disabled": true
        },
        {
          "key": "stayDate",
          "value": "",
          "disabled": true
        },
        {
          "key": "roomRoutingId",
          "value": "",
          "disabled": true
        },
        {
          "key": "excludePseudoRoomReservations",
          "value": "",
          "disabled": true
        },
        {
          "key": "excludeReservationIds",
          "value": "123701",
          "disabled": true
        },
        {
          "key": "excludeVIPStatusCodes",
          "value": "CEL",
          "disabled": true
        },
        {
          "key": "excludeSpecials",
          "value": "",
          "disabled": true
        },
        {
          "key": "excludeFloorPreferences",
          "value": "",
          "disabled": true
        },
        {
          "key": "excludeAdvanceCheckedIn",
          "value": "",
          "disabled": true
        },
        {
          "key": "reservationStatuses",
          "value": "NoShow",
          "disabled": true
        },
        {
          "key": "transportationCodes",
          "value": "",
          "disabled": true
        },
        {
          "key": "roomReadyStatuses",
          "value": "Failed",
          "disabled": true
        },
        {
          "key": "text",
          "value": "smith"
        }
      ]
    }
  },
  "response": [
  ]
}