DataWorks DataService Studio allows you to consume data by using APIs and can provide data for business that uses APIs to receive data. This tutorial walks through creating, configuring, testing, and publishing a user profile API backed by a StarRocks data source.
By the end, you will have a published API endpoint that downstream applications can call directly.
Prerequisites
Before you begin, ensure that you have:
An exclusive resource group for DataService Studio or a data service quota configured for your serverless resource group, with your StarRocks computing resource connected to that resource group
Processed data — specifically, a website user profile table
After data processing completes, a table named ads_user_info_1d_${Data source type} is generated. In this tutorial, the table is ads_user_info_1d_StarRocks.
Create a user profile API
DataService Studio supports two ways to create an API: the codeless UI (Wizard Mode) and the code editor. This tutorial uses the codeless UI.
Step 1: Create the API
Log on to the DataWorks console. In the top navigation bar, select the desired region. In the left-side navigation pane, choose Data Analysis and Service > DataService Studio. Select the desired workspace from the drop-down list and click Go to DataService Studio.
In the Service Development pane, click the
icon and choose Create API > Generate API.In the Generate API dialog box, configure the parameters to create an API using Wizard Mode.
This tutorial uses Wizard Mode (codeless UI). For information about how to create an API by using the codeless UI, see Create an API by using the codeless UI. For information about how to create an API by using the code editor, see Create an API by using the code editor.
Step 2: Configure the API
Select table
Configure the data source and table for the API. For full parameter details, see Create an API by using the codeless UI.
| Parameter | Description | Example value |
|---|---|---|
| Datasource Type | The data source type. API-based data services do not support Hive data sources. | StarRocks |
| Datasource Name | The data source to query. | Doc_StarRocks_Storage_Compute_Tightly_01 |
| Datasource Env. | The environment to use. | Production |
| Table Name | The table to expose through the API. | ads_user_info_1d_StarRocks |
| Pagination for Return Results | Whether to paginate the returned results. | Turned off |
| Set as Req Param | Fields to use as request parameters. | Partition field dt |
| Set as Resp Param | Fields to include in the response. | All fields in ads_user_info_1d_StarRocks |
| Sort field | Fields to sort returned data by. | None |
If you turn on Pagination for Return Results, click Resource Group in the right-side navigation pane and configure Maximum Number of Data Records for a Single Request based on your resource group type. For details, see Configure the API.
Configure a resource group
After configuring the table settings, click Resource Group in the right-side navigation pane. For details, see Configure a resource group for DataService Studio.
| Parameter | Description | Example value |
|---|---|---|
| Scheme | The resource group type. | Exclusive Resource Group for DataService Studio |
| Exclusive Resource Group for DataService Studio | Select an exclusive resource group or a serverless resource group. | Select the available resource group |
| Function Timeout | Maximum execution time per request, in milliseconds. | 30000 |
| Maximum Number of Data Records for a Single Request | Maximum rows returned per request. | 2000 |
If you have purchased an exclusive resource group for DataService Studio, select it directly.
If no resource group is available, purchase a serverless resource group. See Create and use a serverless resource group.
If the serverless resource group is dimmed, configure compute unit (CU) quotas for DataService Studio first. See Manage quotas.
Step 3: Test and publish the API
Test the API
Click the
icon in the top toolbar to save the API.Click the
icon to open the Test APIs dialog box.Specify values for all request parameters and click Test.

For more details, see Test an API.
Publish the API
After the test passes, publish the API to API Gateway to generate a live endpoint.
Click the
icon in the top toolbar to submit the API. A version is generated after submission. To view all versions, click Version in the right-side navigation pane.
In the Actions column of the target version, click Publish.
After publishing, click Service Management in the Actions column to manage the API. Alternatively, click Service Management in the top navigation bar and go to the Published APIs tab on the Manage APIs page. For details, see Manage and maintain APIs.
For more details, see Publish an API.
What's next
With the API published, you can call the API and grant other workspaces permission to call it.