All Products
Search
Document Center

:Add a RestAPI data source

Last Updated:Jan 22, 2025

If a data source can be connected by using APIs, you can use the RestAPI (HTTP) feature of Alibaba Cloud DataWorks to connect to the data source and integrate data. Before you use this feature to integrate data, you must add a RestAPI data source. This topic describes how to add a RestAPI data source.

Procedure

Workspaces in standard mode allow you to isolate data sources. You can separately add data sources for the development and production environments to isolate the data sources. This keeps your data secure. For more information, see Isolate a data source in the development and production environments.

If you use a DataWorks workspace in standard mode, perform the following steps to add a data source separately in the development and production environments:

  1. Go to the Data Sources page.

    1. Log on to the DataWorks console. In the top navigation bar, select the desired region. In the left-side navigation pane, choose More > Management Center. On the page that appears, select the desired workspace from the drop-down list and click Go to Management Center.

    2. In the left-side navigation pane of the SettingCenter page, choose Data Sources > Data Sources.

    Note

    You can also go to the Data Sources page in Data Integration to add a data source. However, you can add a data source on the Data Sources page in Data Integration only to the production environment.

  2. On the Data Sources page, click Add Data Source.

  3. In the Add Data Source dialog box, click RestAPI.

  4. On the Add RestAPI Data Source page, configure the parameters.

    restapi

    Parameter

    Description

    Data Source Name

    The name of the data source. The name can contain only letters, digits, and underscores (_) and must start with a letter.

    Data Source Description

    The description of the data source. The description cannot exceed 80 characters in length.

    URL

    The URL of the RESTful API.

    Default Request Header

    The content of the header in each request that is transferred to the URL.

    Authentication Method

    The authentication method. Valid values: Basic Authentication and Token Authentication. You must select an authentication method and configure the displayed authentication parameters based on the authentication method that is supported by the data source.

    • Basic Authentication: basic authentication

      If the data source supports username- and password-based authentication, you can select Basic Authentication and configure the username and password that can be used for authentication. During data integration, the username and password are transferred to the RESTful API URL for authentication. The data source is connected only after the authentication is successful.

    • Token Authentication: token-based authentication

      If the data source supports token-based authentication, you can select Token Authentication and configure a fixed token value that can be used for authentication. During data integration, the token is contained in the request header, such as {"Authorization":"Bearer TokenXXXXXX"}, and transferred to the RESTful API URL for authentication. The data source is connected only after the authentication is successful.

      Note

      If you want to use a custom authentication method, you can select Token Authentication and configure a fixed token value in the Token field. The token value can be used for authentication after it is encrypted.

    Note

    If the current workspace is in standard mode, we recommend that you add the data source in both the development and production environments to ensure that you can use features as expected and implement standardized development and production processes.

  5. In the Connection Configuration section, select Data Integration.

  6. In the resource group list, find the resource group that you want to use and click Test Network Connectivity in the Connection Status column.

    You must make sure that a network connection is established between the resource group that you want to use and the data source. Otherwise, the related synchronization task cannot be run as expected. If you want to test network connectivity between multiple resource groups and the data source at a time, select the resource groups and click Batch Test Network Connectivity. For more information, see Network connectivity solutions.

  7. After the network connectivity test is passed, click Complete Creation.

What to do next

After the RestAPI data source is added, you can configure a synchronization task for the data source by using the codeless user interface (UI) or code editor.