|
1 | 1 | # Redpanda Cloud Data Plane API Quickstart |
2 | 2 |
|
3 | | -The following steps describe how to authenticate with the Data Plane API. For more information on the Data Plane API, see the Redpanda Cloud API Overview. |
| 3 | +The following steps describe how to authenticate with the Data Plane APIs and create a new topic. For more information on the Data Plane APIs, see the Cloud API Overview. |
4 | 4 |
|
5 | 5 | > **Note:** Redpanda Cloud uses a control plane and data plane architecture. To see the available endpoints for managing your clusters, networks, and resource groups, see the Control Plane API Reference. |
6 | 6 |
|
7 | 7 | ## Requirements |
8 | 8 |
|
9 | | -To use the Data Plane API: |
| 9 | +To use the Data Plane APIs: |
10 | 10 |
|
11 | 11 | 1. You must be a customer with an existing organization in Redpanda Cloud. |
12 | 12 | 2. You can only use one organization for authentication. |
13 | | -3. You must have a running cluster in Redpanda Cloud. |
| 13 | +3. You must have a running cluster in Redpanda Cloud. If you don't have an existing cluster, follow the Control Plane API Quickstart to create one. |
14 | 14 |
|
15 | 15 | ### Authenticate to the API from API Explorer |
16 | 16 |
|
17 | | -You can issue requests against the Data Plane API from your browser when viewing the API Explorer: |
| 17 | +To make API requests in your browser, you must obtain an access token. You can do so by clicking **Get token** on the API endpoint you want to call. |
18 | 18 |
|
19 | | -1. In the Redpanda Cloud UI, create a [service account (client)](https://cloud.redpanda.com/organization-iam?tab=service-accounts). Save the client ID and secret. |
20 | | -1. Go to the "Get access token" endpoint and click **Run in API Explorer**. |
21 | | -1. In the request body: |
22 | | - 1. For `grant_type`, select `client_credentials`. |
23 | | - 1. Enter the `client_id` and `client_secret` values you generated using the service account. |
24 | | - 1. For `audience`, select `cloudv2-production.redpanda.cloud`. |
25 | | -1. Click **Send Request** on the code example to the right. |
| 19 | +If you successfully retrieve an access token, it is valid for one hour. You can use the same token in requests to both Control Plane and Data Plane API endpoints, for as long as the token is valid. |
26 | 20 |
|
27 | | -The Response block should populate with an `access_token` value. Copy the string value without the quotes. To you make your next request on a different endpoint in the API Explorer, add the access token in the Authentication field. |
| 21 | +## Create a topic |
28 | 22 |
|
29 | 23 | > **Warning:** API requests from this page are executed against your actual environment and data, not a sandbox. |
30 | 24 |
|
31 | | -## Create a topic |
| 25 | +1. In the page header, click **API Explorer**. |
| 26 | +1. If you don't already have the data plane API URL for your target cluster, make a Get Cluster (BYOC, Dedicated) or Get Serverless Cluster (Serverless) request with the Control Plane API. The response contains the data plane API URL. Copy the value of `dataplane_api.url` from the response body, and enter it in the URL field. |
| 27 | +1. On the **Choose an operation** dropdown, select **Create topic**. |
| 28 | +1. Click **Get token**. You may be prompted to log in to the Redpanda Cloud UI. After you log in, the browser automatically redirects you back to the Create resource group endpoint in the API Explorer. |
| 29 | +1. Enter a name for your topic and click **Send request**. |
| 30 | +1. Confirm that your topic is successfully created by making a List topics request. |
| 31 | + |
| 32 | +## Next steps |
| 33 | + |
| 34 | +The quickest ways to produce to and consume from the topic are to use [`rpk`](https://docs.redpanda.com/redpanda-cloud/manage/rpk/rpk-install/) or the [Redpanda HTTP Proxy](https://docs.redpanda.com/api/doc/http-proxy) (BYOC and Dedicated clusters only). |
| 35 | + |
| 36 | +For example, to use `rpk` to produce to a topic named `test-topic`, run: |
32 | 37 |
|
33 | | -1. If you don't already have the data plane API URL for your target cluster, make a Get Cluster (BYOC, Dedicated) or Get Serverless Cluster (Serverless) request against the Control Plane API. The response contains the Data Plane API URL. Copy the value of `dataplane_api.url` from the response body. |
34 | | -1. Go to **API Servers** in the sidebar and select “\{dataplane_api_url} - Data Plane API”. Paste the URL into the `dataplane_api_url` field. |
35 | | -1. To create a new Redpanda topic, make a Create Topic request. |
| 38 | +``` |
| 39 | +echo "hello" | rpk topic produce test-topic |
| 40 | +``` |
36 | 41 |
|
| 42 | +## Suggested reading |
37 | 43 |
|
| 44 | +- Use the Data Plane APIs to do [common tasks](https://docs.redpanda.com/redpanda-cloud/manage/api/cloud-dataplane-api) in your cluster such as create a user or use Redpanda Connect. |
| 45 | +- [`rpk topic produce`](https://docs.redpanda.com/redpanda-cloud/reference/rpk/rpk-topic/rpk-topic-produce/) |
| 46 | +- [`rpk topic consume`](https://docs.redpanda.com/redpanda-cloud/reference/rpk/rpk-topic/rpk-topic-consume/) |
38 | 47 |
|
0 commit comments