Register an external API service

Updated at:
Copy as MD

You can register existing API services with DataWorks DataService Studio for centralized management. This lets you view call information and logs, manage tags and versions, and more.

Register an API

If you do not have an API, create one first. For more information, see Generate an API from a data source (API Gateway).

  1. On the Service Development page, click the 新建 icon and choose Create API > Register API.

    Alternatively, you can open the relevant business process, right-click API, and choose Create API > Register API.

  2. In the Register API dialog box, configure the parameters.

    注册API

    Parameter

    Description

    Location

    The directory where the API is stored.

    Important

    We recommend that you select the destination folder first. If no folder is available for selection, create a business process first.

    API Name

    A unique name for the API within the API Gateway group and the workspace.

    APIPath

    The path for the API, such as /user.

    Protocol

    Supported protocols: HTTP and HTTPS.

    If you need to call the API over HTTPS, you must publish the API to API Gateway, bind a dedicated domain name in the API Gateway console, and upload an SSL certificate. For more information, see Enable HTTPS.

    Request Method

    Supported methods: GET, POST, PUT, and DELETE.

    Response Type

    Supported types: JSON and XML.

    Visible Scope

    The available options are Work space and Private.

    • Work space: 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 for private APIs.

      Note

      If you set the visible scope to private, the API is visible only to you in the directory tree, and other workspace members cannot see it.

    Tag

    Select a tag from the Tag list.

    Description

    The API description, up to 2,000 characters long.

Configure the API

  1. Double-click the registered API to open its configuration page. In the Define Backend Service section, configure the following parameters.

    后端服务定义

    Parameter

    Description

    Host

    The host of the backend service. The value must start with http:// or https:// and must not contain a path.

    Note

    For example, if your service URL is http://xxx-cn-xxx.alicloudapi.com/user/info, you can set the backend service host to http://xxx-cn-xxx.alicloudapi.com. Configure this parameter based on the actual URL of your service.

    Path

    The path of the backend service. You can include path parameters in brackets ([]), such as /user/[userid].

    After you configure parameters in the path, the system automatically adds them to the request parameters list and sets their parameter position to PATH.

    Note

    For example, if your service URL is http://xxx-cn-xxx.alicloudapi.com/user/info, you can set the backend service path to /user/info. Configure this parameter based on the actual URL of your service.

    Back-end Service Timeout

    The timeout period for the backend service.

  2. In the Define Request Parameters section, configure the following parameters.

    请求参数定义

    Parameter

    Description

    Request Parameters

    Click Add to configure the request parameters for the API.

    The Parameter Position can be QUERY, HEAD, PATH, or Body. The available positions depend on the selected request method. Choose a position based on your requirements.

    Constant Parameters

    Constant parameters have fixed values and are hidden from API callers. Callers do not need to pass these parameters, but the backend service always receives them with their configured values.

    Request body definition

    This section appears only when the request method is POST or PUT.

    You can provide a sample request body in JSON or XML format to show callers how to structure the request.

  3. In the Define Response Content section, provide a Correct Response Example and an Error Response Example. These examples help API callers understand the response format and write parsing code.

  4. In the Error Code Definition section, define the Error Code, Error message, and Solution for potential errors. This information helps API callers diagnose and resolve issues independently.

  5. Click the 保存 icon in the top toolbar to save the API.

Next steps

  • Test and publish:

    • After configuring the API, you can test it. For more information, see Test an API.

    • After the test succeeds, click Submission in the upper-right corner.

    • On the API editing page, click Version in the right-side navigation pane. Find the version you want to publish and click Request to Publish. On the application page, the application type defaults to Publish API in DataService Studio. Enter a Application Reason and click Requested Permissions to submit your request.

      Note

      If your workspace in the DataWorks Approval Center is configured with an approval workflow, the request must be approved before the API can be published. For more information, see Approval Center Overview.

    • After the API is published, the settings for the resource group for DataService Studio apply to all API calls.

  • Manage APIs: On the Service Development page, you can manage APIs by cloning or deleting them from the directory tree. On the Service Management page, you can expand the API list to view details of published APIs. For more information, see View, delete, move, clone, perform batch operations on, and search APIs by code.