If a data source can be connected by using APIs, you can use the RestAPI feature of Alibaba Cloud DataWorks to connect to the data source and integrate data. Before you use this feature to integrate data, you must configure the data source as a RestAPI data source.

Limits

RestAPI data sources support only exclusive resource groups for Data Integration. For more information, see Exclusive resource group for Data Integration.

Procedure

Workspaces in standard mode allow you to isolate data sources. You can add data sources for the development and production environments separately to isolate the data sources. This ensures data security. For more information, see Isolate connections between the development and production environments.

If you use a DataWorks workspace in standard mode, perform the following steps to add a data source in the development environment and another data source in the production environment.

  1. Go to the Data Source page.
    1. Log on to the DataWorks console.
    2. In the left-side navigation pane, click Workspaces.
    3. In the top navigation bar, select the region where your workspace resides. Find your workspace and click Data Integration in the Actions column.
    4. On the page that appears, click Connection in the left-side navigation pane. The Data Source page appears.
  2. On the Data Source page, click New data source in the upper-right corner.
  3. In the Add data source dialog box, click RestAPI in the Semi-structured storage section.
  4. In the Add RestAPI data source dialog box, set the parameters as required.
    restapi
    Parameter Description
    Data Source Name The name of the data source. The name must contain letters, digits, and underscores (_) and start with a letter.
    Data source description The description of the data source. The description cannot exceed 80 characters in length.
    Network connection type Select a network connection type based on the network environment of the data source.
    Environment Valid values: Development and Production.
    Note This parameter is displayed only if the workspace is in standard mode.
    url The RESTful API URL.
    Default header The content of the header in each request that is transferred to the URL.
    Auth method The RestAPI feature supports the following authentication methods: Basic Auth, Token Auth, and Aliyun API Signature. You must select an authentication method and configure the displayed authentication parameters based on the authentication method that is supported by the data source API.
    • Basic Auth: basic authentication

      If the data source API supports username and password-based authentication, you can select Basic Auth and configure the username and password to 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 succeeds.

    • Token Auth: token-based authentication

      If the data source API supports token-based authentication, you can select Token Auth and configure a fixed token value to 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 succeeds.

    • Aliyun API Signature: Alibaba Cloud API signature-based authentication

      If the following conditions are met, you can select Aliyun API Signature and configure the AccessKey ID and AccessKey secret to be used for authentication: The data source you want to connect is an Alibaba Cloud service and the API of this service supports AccessKey pair-based authentication.

  5. On the Data Integration tab, click Test connectivity in the Operation column of each resource group.
    A sync node uses only one resource group. To ensure that your sync nodes can be properly run, you must test the connectivity of all the resource groups for Data Integration on which your sync nodes will be run. If you need to test the connectivity of multiple resource groups for Data Integration at a time, select the resource groups and click Batch test connectivity. For more information, see Test data store connectivity.
  6. After the connection passes the connectivity test, click Complete.

What to do next

After you add a RestAPI data source, you can configure a Data Integration node by using the codeless user interface (UI) or code editor.