Data service APIs

更新时间: 2026-08-20 10:39:39

The DataService Studio module in DataWorks lets you expose data through APIs for your business applications. This topic demonstrates how to create a data service API by using a sample scenario.

Prerequisites

Create a user profile API

Synchronizing and processing your data generates the ads_user_info_1d table. To expose this data through an API, use the API feature in DataService Studio. You can generate an API in either Wizard Mode or Script Mode.

Step 1: Generate the user profile API

Perform the following steps in DataService Studio.

  1. Log on to the DataWorks console. In the target region, click Data Analysis and Service > DataService Studio in the left-side navigation pane. Select a workspace from the drop-down list and click Go to DataService Studio.

  2. Create an API.

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

    Note

    You can generate an API in Wizard Mode or Script Mode. This example uses Wizard Mode.

Step 2: Configure the user profile API

  1. Configure the API.

    In Wizard Mode, configure the following parameters to create a data service API for a MaxCompute data source. For more information, see Generate an API from a data source (API Gateway).

    Module

    Parameter

    Description

    Example

    Table

    Data Source Type

    Select the data source type.

    Note

    Data service APIs do not support Hive data sources. The available data source types are limited to the options in the drop-down list.

    This example uses a MaxCompute data source.

    Data Source Name

    Select an existing data source.

    Use your business data source.

    Data Source Environment

    • Production Environment

    • Development Environment

    Select Production Environment.

    Data Table Name

    Select the table for the API.

    Select the ads_user_info_1d table.

    Select Parameters

    Pagination for Return Results

    Enable or disable pagination for the results. This setting affects the request and response parameters of the API.

    In the Service Resource Group panel on the right, you can set the maximum number of data records for a single request based on the resource group type. For more information, see Generate an API from a data source (API Gateway).

    Disable Pagination for Return Results.

    Set as Req Param

    Select fields to use as request parameters.

    Set the dt partition field as a Request Parameters.

    Set as Resp Param

    Select fields to use as response parameters.

    Set all fields in the ads_user_info_1d table as Response Parameters.

    Sorting Fields

    The sort field is optional. If you want to sort by a field, first select the desired field from the list of parameters.

    Do not sort.

  2. Configure the service resource group

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

    Module

    Parameter

    Description

    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 you do not have a resource group, we recommend purchasing a general-purpose serverless resource group. For more information, see Use a serverless resource group.

      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 Data Services usage of the resource group. For more information, see Allocate CU quotas to tasks.

    Environment Configuration

    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 it returns the expected response parameters. For more information, see Test an API.

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

    2. In the API test dialog box, enter values for the request parameters.

    3. Click Start Test to start the API test.

  2. Publishing an API adds it to API Gateway and generates an online endpoint. For more information, see Test, publish, and manage versions of an API.

    1. After the API passes the test, click the image icon on the API editing page to submit the API. A new API version is generated. In the right-side panel of the API details page, click the Version tab to go to the version management page. Find the version with the Publishable status, such as v1.

    2. Click Publish to publish the API.

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

Next steps

After the API is published, you can authorize and call it. For more information, see Authorize an API and Call an API.

上一篇: Monitor data quality 下一篇: Data visualization
阿里云首页 大数据开发治理平台 DataWorks 相关技术圈