Chilkat Online Tools

phpAx / ORACLE Hospitality OPERA Cloud REST API Workflows / Get existing upsell rules

Back to Collection Items

<?php

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

$http = new COM("Chilkat_9_5_0.Http");

$queryParams = new COM("Chilkat_9_5_0.JsonObject");
$queryParams->UpdateString('searchByRoomType','true');

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

// resp is a Chilkat_9_5_0.HttpResponse
$resp = $http->QuickRequestParams('GET','https://domain.com/rsv/config/v0/hotels/{{HotelId}}/upsellRules',$queryParams);
if ($http->LastMethodSuccess == 0) {
    print $http->LastErrorText . "\n";
    exit;
}

print $resp->StatusCode . "\n";
print $resp->BodyStr . "\n";


?>

Curl Command

curl -G -d "searchByRoomType=true"
	-H "Authorization: Bearer <access_token>"
	-H "x-app-key: {{AppKey}}"
	-H "x-hotelid: {{HotelId}}"
https://domain.com/rsv/config/v0/hotels/{{HotelId}}/upsellRules

Postman Collection Item JSON

{
  "name": "Get existing upsell rules",
  "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}}/rsv/config/v0/hotels/{{HotelId}}/upsellRules?searchByRoomType=true",
      "host": [
        "{{HostName}}"
      ],
      "path": [
        "rsv",
        "config",
        "v0",
        "hotels",
        "{{HotelId}}",
        "upsellRules"
      ],
      "query": [
        {
          "key": "searchByRoomType",
          "value": "true"
        }
      ]
    }
  },
  "response": [
  ]
}