Learn About REST Notifications

When it comes to sending REST API invocations for other applications where there isn’t a native OCI connector implemented (e.g., Functions), OCI only allows the use of HTTPS and not HTTP.

This ensures a degree of security and the adoption of good practices. However, for a demonstrator to create a dummy client that is aimed at allowing us to see the receipt of a message, it does create extra setup effort to establish a certificate that will be trusted (i.e., not self-signing certificates). As we’re working with APIs, we can simply use a mocking / test tool product. For this demo, we’re going to use Postman. There are plenty of other tools, but as a product, it has a free-use tier and is well known.

Configure a Mock Endpoint

If you don’t have a Postman account, then the first step is to create a cloud account.

With the cloud account set up, we can start to configure Postman. You’ll need a Workspace; use your default space or create a separate one. Then we want to create a mock server.

Once the mock server configuration is complete, we need to see the URL for the server as this will be needed to help set up the ONS subscription. We can see this in the Mock server view configuration tab.

Configure the REST Subscription on ONS

The process of setting up the subscription in OCI is very similar to Slack. Essentially, we just provide the Postman REST endpoint of our mock server.

As with the Slack setup, the first message sent to the subscriber is the URL validator, which can be done with the OCI subscription console. In this case, we see this as a URL in the POST message header attribute and as a message payload in the body. The provided URL needs to be called to enable subsequent messages to be sent. So the URL needs to be copied to a browser. The result will be a web page confirming the activation.

For a real client application, it becomes necessary to provide the necessary trigger logic, or the invocations are routed via proxy that can filter out the initial calls and enable the consumer point.

See Explore More for links to detailed setup instructions.

Rerun the Client Application

Previously, the notification messages we sent were in clear text. However, an application will expect the payload body to be JSON. By rerunning our app and sending notification messages, we'll see the data flowing to both Slack and to our mock server. We can see subsequent messages reaching the mock server. Once enabled, we can see messages such as this using Postman.