All Products
Search
Document Center

DataWorks:Use an API to provide data services

Last Updated:Mar 26, 2026

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:

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

  1. 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.

  2. In the Service Development pane, click the image icon and choose Create API > Generate API.

  3. 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:

  1. 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.
  2. For Datasource Name, select Doc_StarRocks_Storage_Compute_Tightly_01.

  3. For Datasource Env., select Production.

  4. For Table Name, select ads_user_info_1d_StarRocks.

Under Select Parameters:

  1. 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.
  2. For Set as Req Param, select the partition field dt.

  3. For Set as Resp Param, select all fields in ads_user_info_1d_StarRocks.

  4. 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.

  1. For Scheme under Resource Group Type, select Exclusive Resource Group for DataService Studio.

  2. 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.

  3. For Function Timeout under Environment Configuration, enter 30000 (milliseconds).

  4. 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

  1. Click the image icon in the top toolbar to save the API, then click the image icon to open the Test APIs dialog box.

  2. In the Test APIs dialog box, specify values for all request parameters.

  3. Click Test to run the test. image

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.

  1. Click the image 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. image

  2. In the Actions column of the target version, click Publish.

  3. 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.