OS1 Concepts

Asynchronous APIs

9min

Overview

OS1 allows you to capture events asynchronously and be automatically notified of CRUD events that pertain to OS1 services. This allows for a more efficient, responsive system, enabling apps to continue processing other tasks while waiting for service updates.

How it Works

When your app sends us instructions to execute different operations, we respond via callbacks. With callbacks, consuming apps can specify where to send updates about requested CRUD operations, allowing real-time data processing and a more responsive application.

Setting up Callback Notifications

Follow the steps below to receive asynchronous updates:

Step 1: Register the Callback URL

Define a unique callback URL in your application that will receive the updates. Then, ensure the URL is publicly available and can handle incoming HTTP requests.

Step 2: Specify the Callback URL in the request.

To listen to updates, send an API request to OS1 specifying your callback URL where we'll send the requested information.

See the sample request below for creating a Container:

Curl


Step 3: Handling callbacks

Once we receive and process the API request, our system sends an update about the requested information to the defined callback URL with the following information:

  • Event type: The type of event that triggered the update.
  • Service: The event’s service type (Participant, Container, or Entity).
  • Data: The data associated with the event.

Lastly, configure your app to handle callbacks using the following:

Parse the incoming request

Your app should parse the incoming POST request to extract the event information when receiving a callback.

See the example below of the response payload sent to the callback URL for the Container creation mentioned above:

JSON


Process the update

Based on the type of event and service, your app should perform the appropriate action, such as displaying a notification or triggering a specific workflow.

Send an acknowledgment

Once your app processes the update, your app should send one of the following HTTP responses acknowledging that the callback was accepted:

  • 200
  • 202

Signature Verification in Callbacks

The Callback feature is used in different services of OS1. Signature verification is implied in the Callback system to prevent unexpected and unauthenticated loads on that service. Whenever a callback is received it can be verified at OS1.

  • It provides the ability to register a token/secret.
  • Return an HMAC signature with every callback.