Chilkat Online Tools

autoit / ORACLE Hospitality OPERA Cloud REST API Workflows / 02. Booking - getProfiles

Back to Collection Items

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

$oHttp = ObjCreate("Chilkat_9_5_0.Http")
Local $bSuccess

$oQueryParams = ObjCreate("Chilkat_9_5_0.JsonObject")
$oQueryParams.UpdateString("profileName","Smith")
$oQueryParams.UpdateString("givenName","Ann")

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

Local $oResp = $oHttp.QuickRequestParams("GET","https://domain.com/crm/v0/profiles",$oQueryParams)
If ($oHttp.LastMethodSuccess = False) Then
    ConsoleWrite($oHttp.LastErrorText & @CRLF)
    Exit
EndIf

ConsoleWrite($oResp.StatusCode & @CRLF)
ConsoleWrite($oResp.BodyStr & @CRLF)

Curl Command

curl -G -d "profileName=Smith"
	-d "givenName=Ann"
	-H "Authorization: Bearer <access_token>"
	-H "x-app-key: {{AppKey}}"
	-H "x-hotelid: {{HotelId}}"
https://domain.com/crm/v0/profiles

Postman Collection Item JSON

{
  "name": "02. Booking - getProfiles",
  "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}}/crm/v0/profiles?profileName=Smith&givenName=Ann",
      "host": [
        "{{HostName}}"
      ],
      "path": [
        "crm",
        "v0",
        "profiles"
      ],
      "query": [
        {
          "key": "profileName",
          "value": "Smith"
        },
        {
          "key": "givenName",
          "value": "Ann"
        },
        {
          "key": "profileType",
          "value": "Guest",
          "disabled": true
        },
        {
          "key": "hotelId",
          "value": "",
          "disabled": true
        },
        {
          "key": "limit",
          "value": "3",
          "disabled": true
        },
        {
          "key": "city",
          "value": "",
          "disabled": true
        },
        {
          "key": "state",
          "value": "",
          "disabled": true
        },
        {
          "key": "postalCode",
          "value": "",
          "disabled": true
        }
      ]
    }
  },
  "response": [
  ]
}