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

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

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

  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 an API using Wizard Mode.

Note

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.

ParameterDescriptionExample value
Datasource TypeThe data source type. API-based data services do not support Hive data sources.StarRocks
Datasource NameThe data source to query.Doc_StarRocks_Storage_Compute_Tightly_01
Datasource Env.The environment to use.Production
Table NameThe table to expose through the API.ads_user_info_1d_StarRocks
Pagination for Return ResultsWhether to paginate the returned results.Turned off
Set as Req ParamFields to use as request parameters.Partition field dt
Set as Resp ParamFields to include in the response.All fields in ads_user_info_1d_StarRocks
Sort fieldFields to sort returned data by.None
Note

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.

ParameterDescriptionExample value
SchemeThe resource group type.Exclusive Resource Group for DataService Studio
Exclusive Resource Group for DataService StudioSelect an exclusive resource group or a serverless resource group.Select the available resource group
Function TimeoutMaximum execution time per request, in milliseconds.30000
Maximum Number of Data Records for a Single RequestMaximum rows returned per request.2000
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 is dimmed, configure compute unit (CU) quotas for DataService Studio first. See Manage quotas.

Step 3: Test and publish the API

Test the API

  1. Click the image icon in the top toolbar to save the API.

  2. Click the image icon to open the Test APIs dialog box.

  3. Specify values for all request parameters and click Test.image

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.

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