1. Operating StreamNative Platform
  2. Protocols

Configure Message Rest API

Set up Message REST API

Before using Rest API, you need to complete the following setup steps.

Step 1: Create a service account

Note

Currently, you can't edit a service account. If you need a service account to have Super Admin access, make sure to enable it when creating the service account. By default, service accounts do not have Super Admin enabled.

To create a service account, follow these steps.

  1. On the left navigation pane, click Service Accounts.

  2. Click Create Service Account.

  3. (Optional) Select Super Admin to grant the service account with Super admin access to a namespace or tenant.

  4. Enter a name for the service account, and then click Confirm.

Step 2: Create an API key of your service account

Note

Before using an API key, verify that the service account is authorized to access the resources, such as tenants, namespaces, and topics.

You can follow the instructions to create an API key for the service account you choose to use.

Step 3: Grant service account permissions

Note

If you use a Super Admin service account, you can skip this step because a Super Admin service account has the required permissions already.

  1. On the left navigation pane, in the Admin section, click Tenants/Namespaces.

  2. Select the Public tenant, then select the Default namespace under the tenant.

  3. Select the POLICY tab.

  4. In the Authorization area, click ADD ROLE, and select the name of the service account you just created in the previous section.

  5. In the Authorization area, on the drop-down menu below the service name you just added, select the consume and produce roles. The roles are added to your service account.

Step 4: Get the HTTP Service URL of your StreamNative cluster

To get the service URL of a Pulsar cluster through the StreamNative Console, follow these steps.

  1. On the left navigation pane, in the Admin area, click Pulsar Clusters.

  2. Select the Details tab, and in the Access Points area, click Copy at the end of the row of the service URL.

Enable Message Rest API

To enable the message Rest API on StreamNative Platform, you can set broker.pulsarRestMessaging.enabled to true and then use the helm upgrade command to update the configuration.

broker:
  pulsarRestMessaging:
    enabled: true

Note

The message Rest API is enabled on the Pulsar broker. To access the message Rest API outside a Kubernetes cluster, you need to expose the Pulsar proxy service and access the exposed proxy endpoint. The Pulsar proxy will forward the message Rest API requests to the Pulsar broker. For more details, see configure networking.

Previous
Configure WebSocket