Before using Rest API, you need to complete the following setup steps.
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.
On the left navigation pane, click Service Accounts.
Click Create Service Account.
(Optional) Select Super Admin to grant the service account with Super admin access to a namespace or tenant.
Enter a name for the service account, and then click Confirm.
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.
If you use a Super Admin service account, you can skip this step because a Super Admin service account has the required permissions already.
On the left navigation pane, in the Admin section, click Tenants/Namespaces.
Select the Public tenant, then select the Default namespace under the tenant.
Select the POLICY tab.
In the Authorization area, click ADD ROLE, and select the name of the service account you just created in the previous section.
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.
To get the service URL(s) of a StreamNative cluster, follow these steps.
Navigate to the Cluster Dashboard page by switching to the cluster workspace.
On the Cluster Dashboard page, click Details tab.
You will see the available service URLs in the Access Points area.
You can click Copy at the end of the row of the service URL that you want to use.
Navigate to the Cluster Dashboard page by switching to the cluster workspace.
On the Cluster Dashboard page, click Details tab.
You will see the available service URLs in the Access Points area.
You can click Copy at the end of the row of the service URL that you want to use.
Rest API does not validate the data schema and directly stores the accepted binary data into a topic. You should ensure the correctness of the data schema to ensure compatibility with the Pulsar client in other languages.
After you have completed the configuration steps above, you can use Rest API to produce and consume messages. Rest API sends binary data. You can use the cURL tool to encode a string (for example Hi Pulsar
) into UTF-8 format bytes. To send bytes in another format, you need to specify an appropriate file. For more information, see the cURL documentation.
Create a subscription on the topic.
You should see the following output:
Produce messages to the topic.
You should see the following output:
Consume messages from the topic.
You should see the following output:
Acknowledge messages.
You should see the following output:
Negative acknowledge messages.
You should see the following output:
For further information, see Message Rest API reference.
Before using Rest API, you need to complete the following setup steps.
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.
On the left navigation pane, click Service Accounts.
Click Create Service Account.
(Optional) Select Super Admin to grant the service account with Super admin access to a namespace or tenant.
Enter a name for the service account, and then click Confirm.
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.
If you use a Super Admin service account, you can skip this step because a Super Admin service account has the required permissions already.
On the left navigation pane, in the Admin section, click Tenants/Namespaces.
Select the Public tenant, then select the Default namespace under the tenant.
Select the POLICY tab.
In the Authorization area, click ADD ROLE, and select the name of the service account you just created in the previous section.
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.
To get the service URL(s) of a StreamNative cluster, follow these steps.
Navigate to the Cluster Dashboard page by switching to the cluster workspace.
On the Cluster Dashboard page, click Details tab.
You will see the available service URLs in the Access Points area.
You can click Copy at the end of the row of the service URL that you want to use.
Navigate to the Cluster Dashboard page by switching to the cluster workspace.
On the Cluster Dashboard page, click Details tab.
You will see the available service URLs in the Access Points area.
You can click Copy at the end of the row of the service URL that you want to use.
Rest API does not validate the data schema and directly stores the accepted binary data into a topic. You should ensure the correctness of the data schema to ensure compatibility with the Pulsar client in other languages.
After you have completed the configuration steps above, you can use Rest API to produce and consume messages. Rest API sends binary data. You can use the cURL tool to encode a string (for example Hi Pulsar
) into UTF-8 format bytes. To send bytes in another format, you need to specify an appropriate file. For more information, see the cURL documentation.
Create a subscription on the topic.
You should see the following output:
Produce messages to the topic.
You should see the following output:
Consume messages from the topic.
You should see the following output:
Acknowledge messages.
You should see the following output:
Negative acknowledge messages.
You should see the following output:
For further information, see Message Rest API reference.