All Products
Search
Document Center

DataWorks:Use an API to provide data services

Last Updated:Mar 27, 2026

DataService Studio lets you expose processed data tables as REST APIs, making that data available to business applications. This tutorial walks through creating, configuring, testing, and publishing an API for the ads_user_info_1d user persona table.

In this tutorial

  1. Generate a user persona API

  2. Configure the API

  3. Test and publish the API

Prerequisites

Before you begin, make sure you have:

  • An exclusive resource group for DataService Studio, or a serverless resource group with a DataService Studio quota allocated, with the MaxCompute compute resource connected to the resource group

  • Completed the Process data tutorial, with the ads_user_info_1d table in your MaxCompute data source

Step 1: Generate a user persona 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. Click the image icon and choose Create API > Generate API.

  3. In the Generate API dialog box, select Wizard Mode and complete the setup.

DataService Studio supports two modes for generating APIs: Wizard Mode and Script Mode. This tutorial uses Wizard Mode. For Script Mode, see Generate an API in the code editor.

Step 2: Configure the API

Configure table and parameters

On the API configuration page, set the following parameters. For full parameter details, see Generate an API in the codeless UI.

Section Parameter Description Value for this tutorial
Select Table Datasource Type The data source type. Hive data sources are not supported. MaxCompute
Datasource Name The data source to query. Select the business data source
Datasource Env The environment for the data source. Production
Table Name The table to expose through the API. ads_user_info_1d
Select Parameters Pagination for Return Results Whether to paginate query results. Affects the request and response parameter structure. Off
Set as Req Param Fields that callers pass as request parameters. dt (partition field)
Set as Resp Param Fields returned in the API response. All fields in ads_user_info_1d
Sort Field (Optional) The field to sort results by. None

Configure the service resource group

Click Resource Group in the right-side navigation pane to assign compute resources to this API.

Section Parameter Value
Resource Group Type Scheme Exclusive Resource Group for DataService Studio
Exclusive Resource Group for DataService Studio Resource group selection Select a serverless resource group (recommended) or an exclusive resource group
Environment Configuration Function Timeout 30000 ms
Maximum Number of Data Records for a Single Request 2000
Important

If a newly purchased serverless resource group appears grayed out and cannot be selected, allocate a DataService Studio quota to it first. See Allocate CU quotas to tasks.

Step 3: Test and publish the API

Test the API

  1. Click the image icon to save the API, then click the image icon to open the test page.

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

  3. Click Test and verify that the response contains the expected data.

For more information, see Test an API.

Publish the API

  1. On the API editing page, click the image icon to submit the API. A new version is created. Click Version on the right side to review the submitted version details.

    image

  2. Click Submit to publish the API service to API Gateway. An online endpoint is generated.

  3. To manage the published API, go to Service Management in the version panel, or navigate to Service Management > Manage APIs > Published APIs. See Manage and maintain APIs.

What's next

With the API published, authorize users and start making calls: