DataWorks DataService Studio lets you expose data tables as callable REST APIs, so downstream business applications can consume data without direct database access.
This tutorial walks you through creating and publishing a user profile API backed by a StarRocks data source (used as an example; other supported data source types are available).
How it works
A processed data table (
ads_user_info_1d_${Data source type}) exists in your data source.You create an API in DataService Studio, pointing it at the table and selecting which fields serve as request and response parameters.
You test the API, then publish it to API Gateway. After publishing, an online calling address is generated that callers can invoke directly.
Prerequisites
Before you begin, ensure that you have:
An exclusive resource group for DataService Studio is created, or a data service quota is configured for your serverless resource group. Your MaxCompute computing resource must be connected to the resource group.
A processed website user profile table. See Process data.
Step 1: Create a user profile API
Log on to the DataWorks console. In the top navigation bar, select the target region. In the left navigation pane, choose Data Analysis and Service > DataService Studio. Select your workspace from the drop-down list, then 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 the codeless UI.
DataService Studio supports two API creation methods: codeless UI and code editor. This tutorial uses the codeless UI. For the code editor method, see Create an API by using the code editor.
DataWorks allows you to create APIs in DataService Studio using either the codeless UI or code editor.
Step 2: Configure the user profile API
With the API created, configure the data table and resource group. For complete field descriptions, see Create an API by using the codeless UI.
Configure the data table
In the Select Table section:
For Datasource Type, select StarRocks.
API-based data services do not support Hive data sources.
For Datasource Name, select the data source — in this example,
Doc_StarRocks_Storage_Compute_Tightly_01.For Datasource Env., select Production.
For Table Name, select the target table — in this example,
ads_user_info_1d_StarRocks.In the Select Parameters section, configure the following:
Pagination for Return Results: Turn this off. When enabled, configure the Maximum Number of Data Records for a Single Request parameter on the Resource Group tab based on the resource group type that you specify.
Set as Req Param: Select the partition field
dtas the request parameter.Set as Resp Param: Select all fields in
ads_user_info_1d_StarRocksas response parameters.Sort field: Leave blank (optional).
Configure the resource group
Click Resource Group in the right navigation pane and configure the following settings. For details, see Configure a resource group for DataService Studio.
Under Resource Group Type > Scheme, select Exclusive Resource Group for DataService Studio.
Under Exclusive Resource Group for DataService Studio, select an exclusive resource group or a serverless resource group.
ImportantIf 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 and cannot be selected, configure compute unit (CU) quotas for DataService Studio first. See Manage quotas.
Under Environment Configuration, set Function Timeout to
30000(milliseconds).Set Maximum Number of Data Records for a Single Request to
2000.
Step 3: Test and publish the API
Test the API
Before publishing, verify that the API returns the expected data.
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, then click Test.

For more information, see Test an API.
Publish the API
Once the test passes, publish the API to make it callable.
Click the
icon in the top toolbar to submit the API. A version is generated. To view all versions, click Version in the right navigation pane.
In the Actions column of the version, click Publish. After the API is published to API Gateway, an online calling address is generated.
To manage the published API, click Service Management in the Actions column, or navigate to Service Management in the top navigation bar and open the Published APIs tab on the Manage APIs page.
For more information, see Publish an API and Manage and maintain APIs.
What's next
Call the API: Send requests to the generated endpoint. See Call an API.
Grant access to other workspaces: If other teams need to call this API, grant them permission first. See Grant permissions to call an API.