DataService Studio in DataWorks is designed to create a unified data service bus, which allows individuals, teams, and enterprises to centrally manage internal and external API services. For example, you can quickly generate an API from a data table query or register existing APIs on the DataService Studio platform for unified publishing and management. This topic uses a MySQL data source as an example to describe the complete API development process.
Prerequisites
API Gateway is activated to centrally manage and call APIs. For more information, see API Gateway.
A destination data source is created. This topic uses a MySQL data source as an example. The data source provides the data required to generate the API. For more information, see Configure a data source.
A Serverless resource group is created and a quota is configured for DataService Studio. For more information, see Configure a quota for DataService Studio in a Serverless resource group.
Background information
DataService Studio acts as a bridge between databases and data applications, providing comprehensive data service and sharing capabilities for individuals, teams, and enterprises. This helps you centrally manage APIs from both inside and outside Alibaba Cloud.
DataService Studio is connected to API Gateway and supports one-click publishing of APIs to API Gateway. Together, DataService Studio and API Gateway provide a secure, stable, cost-effective, and easy-to-use service for exposing and sharing data. For more information about DataService Studio, see DataService Studio.
Go to DataService Studio
Log on to the DataWorks console. In the top navigation bar, select the desired region. In the left-side navigation pane, choose . On the page that appears, select the desired workspace from the drop-down list and click Go to DataService Studio.
Procedure
Step 1: Create a data source and configure network connectivity
Before you create an API in DataService Studio, you must add your database or data warehouse as a DataWorks data source. This data source provides the data for the API. During API development, DataService Studio accesses this data source to retrieve the schema information of the data table. This helps you set the request and response parameters. When the API is called, DataService Studio accesses the data source to run the query. For a list of supported data sources, see List of data sources for DataService Studio.
ImportantIf the connectivity test fails, check the configuration. For more information, see Network connections and whitelists.
DataService Studio provides services to external systems through API Gateway. In API Gateway, a group is a management unit for APIs and is associated with the domain name of the call address. Therefore, you must first create an API group in API Gateway before you create an API in DataService Studio.
Step 3: Create a business process
In DataService Studio, business processes are used to develop APIs based on business units and to organize and manage files, such as APIs and functions. Therefore, you must first create a business process before you create an API.
After you create the business process, you can create APIs within that process.
After you create an API, you must test it. After the API passes the test, you can publish it.
Publish the API that passed the test. After the API is published, other services can call it.
DataService Studio supports calling APIs using simple authentication or encrypted signature authentication. You can select a method based on your requirements.
Step 8: View and manage the API
You can view published APIs on the service management page. DataService Studio also supports management operations, such as unpublishing, authorization, and viewing API call details.
Step 1: Create a data source and configure network connectivity
Before you create an API in DataService Studio, you must add your database or data warehouse as a DataWorks data source. You must also ensure that the DataService Studio resource group can connect to your destination data source so that DataWorks can access the data source when an API is called. This topic uses a MySQL data source named rds_workshop_log as an example and tests its connectivity with the public resource group for DataService Studio.
In the navigation pane on the left, click Data Source Management to go to the data source management page.
Create a data source and test its network connectivity.
Click Add Data Source and select a data source type.
This topic uses MySQL as an example.
Configure the data source information.
Configure the parameters as prompted on the page. For more information, see Configure a MySQL data source.
Select a Serverless resource group and test the connectivity between the resource group and the data source.
NoteIf you have high-concurrency tasks that cannot be run during off-peak hours, you must use dedicated resources to ensure high-concurrency and high-frequency API calls. In this case, you can purchase and use an exclusive resource group for DataService Studio or a Serverless resource group from DataWorks.
When you use a Serverless resource group, you must configure a quota for DataService Studio in the Serverless resource group.
Click Complete to create the data source.
Step 2: Create an API group
DataService Studio provides services to external systems through API Gateway. In API Gateway, a group is a management unit for APIs and is associated with the domain name of the call address. Therefore, you must first create an API group in API Gateway before you create an API in DataService Studio.
Go to the API Gateway console.
In the navigation pane on the left, choose .
On the Group Management page, click Create Group.
This topic uses a group named
Workshopas an example.
Step 3: Create a business process
In DataService Studio, business processes are used to develop APIs based on business units and to organize and manage files, such as APIs and functions. Therefore, you must first create a business process before you create an API.
Create a business process.
On the page, you can create a business process in one of the following ways:
Method 1: Click the
icon and select Create Business Process.Method 2: In the navigation pane on the left, right-click the Business Process folder and select Create Business Process.
Configure the parameters for the business process.
Configuration
Description
Business Name
Enter a custom name based on your business scenario. This topic uses DataService as an example.
API Group
Select an API group to manage your APIs. This topic uses the Workshop group created in Step 2.
NoteAn API group is a collection of APIs for a specific feature or scenario. It is also the smallest unit for API management in API Gateway. To create a new group, see Step 2: Create an API group.
Click OK to create the business process.
After the business process is created, you can view its details in the folder in the navigation pane on the left of the DataService Studio page.
Step 4: Generate an API
Create an API in the business process that you created.
Generate an API.
On the page, you can generate an API in one of the following ways:
Method 1: Click the
icon and choose .Method 2: In the navigation pane on the left, right-click the destination business process and choose .
Define the API properties.
In the Generate API dialog box, configure the API information. The following figure shows an example configuration.
The following table describes the main parameters.Configuration Item
Description
API Mode
Select the mode to create the API. You can choose the codeless UI or the code editor.
Codeless UI: Quickly configure a data API without writing code.
Code editor: Supports advanced features such as table joins, complex queries, and aggregate functions. You can write custom SQL queries for the API to meet advanced query requirements.
This topic uses the codeless UI as an example. For more information about the two modes, see Overview of API generation.
API Name
Enter a custom name for the API. This topic uses
rpt_user_info_all_das an example.API Path
The storage path of the API. This is the URI of the request relative to the service host. This path is used to construct the API call address. This topic uses
/useras an example.Protocol
HTTP and HTTPS are supported.
To call the API over HTTPS, bind an independent domain name and upload an SSL Certificate in the API Gateway console after you publish the API to the gateway. For more information, see Support for HTTPS.
Request Method
GET and POST are supported.
NoteIf you select GET, you can only set the Parameter Position of the Request Parameters to QUERY.
If you select POST, you can set the Parameter Position of the Request Parameters to QUERY or BODY.
Response Type
Only JSON is supported.
Visible Scope
Define the visibility of the API after it is created. Valid values are Workspace and Private.
Workspace: The API is visible to all members in the current workspace.
Private: The API is visible only to the API owner. Authorization is not supported.
This topic uses Workspace as an example.
Destination Folder
Define the folder where the API is stored in the business process on the left. If you have not created a business process, create one. For more information, see Step 3: Create a business process.
Configure the API parameters.
On the API editing page, configure the API parameters. The following figure shows an example configuration.

Select the data source for the API.
In the Select Table section, select the data source table that you want to use to generate the API.
Parameter
Description
Data Source Type
Select the type of data source from which to create the API. This topic uses MySQL as an example.
Data Source Name
The name of the data source of the selected type based on which you want to generate the API. This topic uses the
rds_workshop_logdata source created in Step 1: Create a data source and configure network connectivity as an example.Data Source Environment
Workspaces in standard mode support access to data sources in the development or production environment. For more information about the differences between the two environments, see Differences between workspace modes. This topic uses the Production Environment as an example.
Data Table Name
Select the data table in the data source from which to generate the API. This topic uses the
rpt_user_info_all_dtable in therds_workshop_logdata source as an example.Define the request and response parameters.
After you select a data table, the Select Parameters section automatically displays all fields from the table. Select the fields to use as request and response parameters for the API. To sort the fields, add the target fields to the Sort Fields section and adjust their order.
In this example, the request parameter is
uid, and the response parameters are all fields in the table.NoteIn the right-side navigation pane, click Request Parameters or Response Parameters to modify parameter settings, such as field type, sample value, and default value. You can configure these settings based on your requirements.
Configure the API resource group.
On the API editing page, click Service Resource Group on the right to configure the resource group. Because the default public resource group for DataService Studio will be discontinued, you must configure a new API to use an exclusive service resource group. Select either a Serverless resource group that has a configured quota for DataService Studio or an exclusive resource group for DataService Studio.
Step 5: Test the API
After the API is generated, click Test in the upper-right corner of the API editing page to verify that the request and return value are as expected. In this example, set the value of the uid request parameter to 0016359810821 and test the result. For more information about testing, see Test an API.
Step 6: Publish the API
An API must be submitted and published before it can be called by other services. In the upper-right corner of the API editing page, click Submit and select the version to publish. After the API is published, you can view it in API Gateway. For more information about publishing, see Publish an API.
Step 7: Call the API
The following authentication methods are supported for calling APIs. You can select one based on your requirements:
Simple Authentication: Offers low security. It is suitable for scenarios such as reports and data dashboards.
Encrypted Signature Authentication: Offers high security. It is suitable for application development scenarios.
In the top menu bar of DataService Studio, click Service Management to go to the service management page.
In the navigation pane on the left, select API Invocation.
Published APIs are available in API Gateway. You can call the API using an API Gateway SDK. For more information, see Examples of calling an API from a client.
Step 8: View and manage the API
On the Service Management page, you can view published APIs and perform management operations.
Area | Description |
On the page, you can view currently published APIs, APIs you are authorized to use, and APIs you have authorized to others. You can also perform operations such as unpublishing, authorizing, and testing on APIs for which you have permissions. | |
On the page, you can perform the following operations:
|