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 a sample scenario to describe how to create, configure, test, and publish a user profile API backed by a StarRocks data source using the codeless UI.
Prerequisites
Before you begin, ensure that you have:
-
An exclusive resource group for DataService Studio, or a serverless resource group with a data service quota configured, with your StarRocks computing resource connected to that resource group
-
Processed data with a website user profile table ready for use
Create a user profile API
After data is synchronized and processed, a table named ads_user_info_1d_${Data source type} is generated — in this example, ads_user_info_1d_StarRocks. The steps below expose that table as an API using DataService Studio's codeless UI.
DataService Studio supports two API creation methods: the codeless UI 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 target region. In the left-side navigation pane, choose Data Analysis and Service > DataService Studio. Select the target 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 the API. For detailed steps, see Create an API by using the codeless UI or Create an API by using the code editor.
Step 2: Configure the API
After creating the API, configure the data source and parameters. Then click Resource Group in the right-side navigation pane to complete the resource group settings.
Configure the data source and parameters
In the codeless UI, configure the following settings under Select Table:
-
For Datasource Type, select StarRocks.
API-based data services do not support Hive data sources. The full list of supported data source types is available when you configure this field.
-
For Datasource Name, select
Doc_StarRocks_Storage_Compute_Tightly_01. -
For Datasource Env., select Production.
-
For Table Name, select
ads_user_info_1d_StarRocks.
Under Select Parameters:
-
For Pagination for Return Results, leave it off.
If you turn on Pagination for Return Results, configure the Maximum Number of Data Records for a Single Request parameter in the Resource Group tab. For details, see Configure the API.
-
For Set as Req Param, select the partition field
dt. -
For Set as Resp Param, select all fields in
ads_user_info_1d_StarRocks. -
Leave the Sort field section blank.
Configure the resource group
Click Resource Group in the right-side navigation pane and configure the following settings. For details, see Configure a resource group for DataService Studio.
-
For Scheme under Resource Group Type, select Exclusive Resource Group for DataService Studio.
-
Under Exclusive Resource Group for DataService Studio, select an exclusive resource group or a serverless resource group (recommended).
Important-
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 appears dimmed and cannot be selected, configure compute unit (CU) quotas for DataService Studio. See Manage quotas.
-
-
For Function Timeout under Environment Configuration, enter
30000(milliseconds). -
For Maximum Number of Data Records for a Single Request under Environment Configuration, enter
2000.
Step 3: Test and publish the API
Test the API
-
Click the
icon in the top toolbar to save the API, then click the
icon to open the Test APIs dialog box. -
In the Test APIs dialog box, specify values for all request parameters.
-
Click Test to run the test.

For details, see Test an API.
Publish the API
After a successful test, publish the API to API Gateway to generate an online calling address.
-
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 the API is published, click Service Management in the Actions column to manage it. 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 the full publishing steps, see Publish an API.
What's next
After the API is published, call the API or grant other workspaces permission to call it.