WebSocket Authorization

Access to the streaming API is protected by oAuth and an application key. The application key comes from the application you created in Registering an Application.

To obtain the oAuth token, follow the processes described in Using the Oracle Hospitality APIs and in Authenticating to Oracle Hospitality Property APIs. For an example of the oAuth token, visit the Get OAuth Token page on the Postman API Platform site at https://www.postman.com/hospitalityapis/workspace/oracle-hospitality-apis/request/15729853-58d0804e-b607-4c37-bf2f-0656c254573c.

Information required to call the WebSocket

To connect to the streaming API, the following pieces of information are required:

Note:

If the URL listed on the Environment panel in the Developer Portal is "https://www.oracle.com," the URL for the streaming API should be "wss://www.oracle.com/subscriptions." The change from "https" to "wss" is required for connection via WebSocket.

Browsing the OHIP Schema

The Documentation Explorer is located on the right-side of the screen.

  1. Click the Subscription link to browse the schema for creating the subscription.

    The Subscription object requires you to specify a "NewEventInput" object containing the chainCode and the offset.

  2. Click NewEventInput to view the data type and limits on these fields.

  3. Click the Subscription arrow to go back to the definition of the Subscription object.

    Returned in the response to this subscription is the type called "EventHeader."

  4. Click the EventHeader to view details of the fields that can be returned (if included in the query).

  5. Click any of these fields to see the object definition, data types, and limits on the fields.

    One of the response fields is the "detail" array, which includes fields such as newValue, oldValue, and elementName (that is, the name of the data element that changed).

  6. Compose your GraphQL query using the left-side of the screen, which includes intellisense to speed up the completion of the query.

  7. Click Start to open the WebSocket connection. Any events meeting the subscription configured in the Developer Portal are sent and appear on the right-side of the screen, but include only those fields specified in the subscription query on the left-side of the screen.

    The right-side of the screen only shows the latest event. Since many events will be sent at once, use the developer tools in the browser to view the full list of sent events.

  8. Click Stop to disconnect the WebSocket.

Note:

When the Auth Token expires, the connection must be severed and then reestablished with a fresh Auth Token every hour.