All Products
Search
Document Center

DataWorks:Use an API to provide data services

Last Updated:Nov 28, 2025

DataService Studio in DataWorks supports data consumption through APIs, which lets you supply data to various business applications. This topic uses a sample scenario to describe how to consume data using an API service in DataWorks.

Prerequisites

Create a user persona API service

After you synchronize and process data, a data table named ads_user_info_1d is generated. You can use this table to provide data to business applications through APIs. DataService Studio in DataWorks provides an API feature that lets you generate an API service in the Codeless UI or Code Editor.

Step 1: Generate a user persona API

This example describes the operations required to use the API feature in DataService Studio.

  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. On the page that appears, select the desired workspace from the drop-down list and click Go to DataService Studio.

  2. Create an API service.

    On the DataService Studio page, click the image icon and choose Create API > Generate API. In the Generate API dialog box, select Wizard Mode to generate the API.

    Note

    You can generate an API in Wizard Mode or Script Mode mode. This topic uses the Wizard Mode as an example.

Step 2: Configure the user persona API

  1. Configure details.

    After you create a user persona API, configure the parameters to implement an API data service for a MaxCompute data source. For more information, see Generate an API in the codeless UI.

    Section

    Parameter

    Configuration

    Example

    Select Table

    Datasource Type

    Select the data source type.

    Note

    API-based data services do not support Hive data sources. The supported data source types are displayed in the drop-down list.

    This example uses a MaxCompute data source.

    Datasource Name

    Select a created data source.

    Use the business data source.

    Datasource Env

    • Production

    • Development

    Select Production

    Table Name

    Select the table to be used by the API.

    Select the ads_user_info_1d table.

    Select Parameters

    Pagination for Return Results

    Specifies whether to enable paging for the returned results. This setting affects the request and response parameters of the API.

    In the service resource group settings in the right-side navigation pane, you can set the maximum number of data records for a single request based on the resource group type. For more information, see Configure an API.

    Turn off Pagination for Return Results.

    Set as Req Param

    Set one or more fields in the table as request parameters.

    Set the dt partition field as a request parameter.

    Set as Resp Param

    Set one or more fields in the table as response parameters.

    Set all fields in the ads_user_info_1d table as response parameters.

    Sort Field

    This parameter is optional. To sort the results by a field, first select the field from the parameter list.

    No sorting is configured.

  2. Configure a service resource group

    After you configure the API in the codeless UI, click Resource Group in the right-side navigation pane to configure service resources. The following table describes the parameters. For more information, see Configure a service resource group for an API.

    Section

    Parameter

    Configuration

    Resource Group Type

    Scheme

    Exclusive Resource Group for DataService Studio.

    Exclusive Resource Group for DataService Studio

    Select a serverless resource group (recommended) or an exclusive resource group for DataService Studio.

    Important
    • If you have purchased an exclusive resource group for DataService Studio, you can use it directly.

    • If no resource group is available, purchase a general-purpose serverless resource group. For more information, see Use serverless resource groups.

      If a newly purchased serverless resource group is grayed out and cannot be selected when you configure the service resource group, you must allocate a quota for the DataService Studio usage of the resource group. For more information, see Allocate CU quotas to tasks.

    Environment Configuration

    Function Timeout

    Set the value to 30000 ms.

    Maximum Number of Data Records for a Single Request

    Set the value to 2000.

Step 3: Test and publish the API

  1. Test the API to verify that the returned parameters meet your expectations. For more information, see Test an API.

    1. After the configuration is complete, click the image icon to save the API, and then click the image icon to open the API test page.

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

    3. Click Test to test the API.

  2. Publish the API to API Gateway to generate an online endpoint. For more information, see Publish an API.

    1. After the API passes the test, on the API editing page, click the image icon to submit the API. A new API version is generated. You can click Version on the right side of the page to view information about the submitted API version.image

    2. Click Submit to publish the API service.

    3. After the API is published, you can manage the published API by clicking Service Management in the version management section or by navigating to Service Management > Manage APIs > Published APIs. For more information, see Manage and maintain APIs.

Next steps

After the API is published, you can perform other operations, such as authorizing and calling the API. For more information, see Authorize an API and Call an API.