All Products
Search
Document Center

DataWorks:Data service APIs

Last Updated:Jun 20, 2026

DataWorks DataService Studio allows you to expose data as APIs. This tutorial provides a step-by-step example of how to create and publish a data service API.

Prerequisites

Create a user profile API

After you synchronize and process data, DataWorks generates a table named ads_user_info_1d_${data_source_type}. You can use DataWorks to expose this table as an API to other services. DataService Studio allows you to generate API services in either the Wizard Mode or the Script Mode.

Step 1: Generate the API

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

    Note

    You can generate an API in codeless UI or code editor. This tutorial uses the codeless UI as an example.

Step 2: Configure the API

  1. Configure the API details.

    In the codeless UI, configure the API to use a StarRocks data source by setting the parameters in the following table. For more information, see Create an API from a data source (API Gateway).

    Module

    Parameter

    Description

    Example

    Table

    Data Source Type

    Select a data source type.

    Note

    DataService Studio does not support the Hive data source. The drop-down list shows all supported types.

    This example uses StarRocks.

    Data Source Name

    Select an existing data source.

    Use the Doc_StarRocks_Storage_Compute_Tightly_01 data source.

    Data Source Environment

    • Production Environment

    • Development Environment

    Select Production Environment.

    Data Table Name

    Select the table to be used by the API.

    Select the ads_user_info_1d_StarRocks table.

    Select Parameters

    Pagination for Return Results

    Determines whether to enable result pagination. This setting affects the request and response parameters.

    You can set the maximum records per request in the resource group settings on the right-side navigation pane. For more information, see Create an API from a data source (API Gateway).

    Keep Pagination for Return Results disabled.

    Set as Req Param

    Select one or more table fields to use as request parameters.

    Set the dt partition field as a Request Parameters.

    Set as Resp Param

    Select one or more table fields to return in the response.

    Set all fields of the ads_user_info_1d_StarRocks table as Response Parameters.

    Sorting Fields

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

    Do not configure sorting.

  2. Configure the service resource group

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

    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 your new serverless resource group appears dimmed and cannot be selected when you configure the resource group, allocate quotas for the Data Services purpose. For details, see Allocate CU quotas to tasks.

    Environment Configuration

    Timeout

    Set to 30,000 ms.

    Maximum Number of Data Records for a Single Request

    Set to 2,000 records.

Step 3: Test and publish the API

  1. Test the API to verify that the response parameters are as expected. For more information, see Test an API.

    1. After configuring the API, click the Save icon image to save it, and then click the Test icon image to open the test page.

    2. In the Test APIs dialog box, enter a value for the request parameter.

    3. Click Start Test to run the test. For example, set the value of the dt parameter to 20240522 and click Test. If the test is successful, the Request Details section on the right displays the execution log and the SQL statement, and the Response section displays the JSON result. An errCode of 0 and an errMsg of success indicate that the API call was successful.

  2. Publishing an API deploys it to API Gateway, which generates an API endpoint. For more information, see API testing, publishing, and version management.

    1. After a successful test, click the Submit icon image on the API editing page to generate a new version. Then, on the API details page, click the Version tab in the right-side pane to open the version management panel. You can view the list of versions and their statuses, such as Publishable.

    2. Click Publish to publish the API.

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

Next steps

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