All Products
Search
Document Center

DataWorks:API data service

Last Updated:Jun 25, 2026

DataService Studio in DataWorks lets you create APIs to expose data as a service, which applications can then consume through standard API calls. This topic shows you how to create, configure, and publish an API.

Prerequisites

Create a user profile API

Data synchronization and processing generates the ads_user_info_1d_${datasource-type} data table. You can then use the API feature in DataService Studio to expose this table to other services by generating an API with the Wizard Mode or Script Mode.

Step 1: Generate the user profile API

This example uses the API feature 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 service.

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

    Note

    DataService Studio offers two methods for generating APIs: codeless UI and code editor. This example uses the codeless UI.

Step 2: Configure the user profile API

  1. Configure the API details.

    In the codeless UI, configure the following parameters for the StarRocks data source API. For more information, see Generate an API from a data source (API Gateway).

    Module

    Parameter

    Description

    Example

    Table

    Data Source Type

    The type of your data source.

    Note

    DataService Studio APIs do not support Hive data sources. The supported types are listed in the drop-down list.

    This topic uses a StarRocks data source as an example.

    Data Source Name

    The data source that you created.

    Use the business data source Doc_StarRocks_Storage_Compute_Tightly_01.

    Data Source Environment

    • Production Environment

    • Development Environment

    Select Production Environment.

    Data Table Name

    The table that the API will use.

    Select the ads_user_info_1d_StarRocks table.

    Select Parameters

    Pagination for Return Results

    Whether you enable pagination affects how you set request parameters and response parameters for the API.

    In the Resource Group section 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 Generate an API from a data source (API Gateway).

    Pagination for Return Results is disabled.

    Set as Req Param

    The table fields to use as request parameters.

    Set the partition field dt as a Request Parameters.

    Set as Resp Param

    The table fields to use as response parameters.

    Set all fields of the ads_user_info_1d_StarRocks table as Response Parameters.

    Sorting Fields

    This parameter is optional. If you want to sort by a field, first select the field in the Select Parameters list.

    Do not sort.

  2. Configure the resource group for the service

    After configuring the API in the codeless UI, 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 resource group for the API.

    Module

    Parameter

    Description

    Resource Group Type

    Scheme

    Exclusive Resource Group for DataService Studio.

    Exclusive Resource Group for DataService Studio

    You can 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, we recommend that you purchase a general-purpose serverless resource group. For more information, see Use a serverless resource group.

      If the newly purchased serverless resource group is dimmed and cannot be selected when you configure the resource group, allocate a quota to the Data Services purpose for the resource group. For more information, see Allocate CU quotas to a task.

    Environment Configuration

    Timeout

    The timeout period for the function, in milliseconds. Example: 30,000.

    Maximum Number of Data Records for a Single Request

    The maximum number of records that a single request can return. Example: 2,000.

Step 3: Test and publish the API

  1. Test the API to verify that its response is correct. For more information, see Test an API.

    1. After the configuration is complete, click the image Save icon, and then click the image Test icon to go to the API test page.

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

    3. Click Start Test to test the API. For example, set the parameter name to dt, the parameter type to STRING, the parameter location to QUERY, and the value to 20240522. You can select Auto-save success response as example and click Test. If the test is successful, the Request Details section displays the executed SQL statement and logs. The response indicates success with an errCode of 0, an errMsg of 'success', and the query results in the data field.

  2. Publishing an API means releasing it to API Gateway to generate a public endpoint. For more information, see Test, publish, and manage versions of an API.

    1. After the API passes the test, click the image Submit icon on the API editing page. This action generates a new API version. Click the Version tab on the right to open the version management panel. In the version list, find the target version, such as v1, with a status of Publishable.

    2. Click Publish.

    3. After the API is published, you can manage it on the Service Management page. Access this page by either clicking Service Management in the version management panel or navigating to Service Management > Manage APIs > Published APIs. For more information, see Manage and maintain APIs.

Next steps

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