Integrate Alibaba Cloud OpenAPI

Updated at:

The Mobi Platform provides a powerful integration feature for Alibaba Cloud OpenAPI. This feature lets you seamlessly connect to and interact with data from Alibaba Cloud OpenAPI interfaces through simple configuration. This document describes how to create and use an Alibaba Cloud OpenAPI integration.

Features

The Alibaba Cloud OpenAPI integration feature on the Mobi Platform supports the following:

  • Custom trigger methods: You can set integration operations to be triggered manually or to run automatically. This meets the needs of different business scenarios.

  • Callbacks and data transformation: You can execute specific integration events when a query succeeds or fails. You can also apply custom processing to the returned data.

  • Advanced configuration: Use advanced configurations for debounce and conditional execution to optimize how integration operations run.

For more information about events, see Integration operation events.

Use an Alibaba Cloud OpenAPI integration

Step 1: Create an Alibaba Cloud OpenAPI integration

  1. Log on to the Mobi Platform and go to the console.

  2. Navigate to Resources > Integration and click Create Integration.

  3. Select Alibaba Cloud OpenAPI. Enter a name and description for the integration.

  4. Configure the Alibaba Cloud OpenAPI integration for different environments. This includes the settings for Product, Version, Region, and AccessKey.

    • Product: The product for which you want to make Alibaba Cloud OpenAPI requests.

    • Version: The version of the product.

    • Region: The region where you want to make the requests.

    • AccessKey: The AccessKey pair used to make OpenAPI requests. For more information, see Create an AccessKey pair.

      Note

      For information about Alibaba Cloud OpenAPI products, versions, and regions, see the Alibaba Cloud OpenAPI Developer Portal.

  5. Click OK to create the integration.

Step 2: Create an integration operation in an application

  1. Open the Code panel. In the relevant scope, click + and select Integration Operation.

  2. Select the Alibaba Cloud OpenAPI integration that you created. After you select an API, its parameters are displayed. Configure the parameters and click Run to view the response from the API.

    • Required parameters: The parameters that are required to call the integration operation. You must configure the parameter name and type. In the interface parameters, you can reference a parameter using the {{ varName }} format.

    • Optional parameters: The parameters that are optional for calling the integration operation. You must configure the parameter name and type. You can also set a default value. In the interface parameters, you can reference a parameter using the {{ varName }} format.

    • API: The product interface of the Alibaba Cloud OpenAPI service that you want to call.

    • protocol: The protocol of the Alibaba Cloud OpenAPI service that you want to call.

    • method: The method of the OpenAPI service that you want to call.

    • Other parameters: Parameter settings for the selected API are automatically generated. Required parameters are marked with a red asterisk (*).

  1. Click Run to preview the query results.

Configuration panel

Callback configuration

  • Data transformation: Processes the data returned by the interface. The default value is return data, which means that no processing is performed.

  • On success: Configures the event to trigger when the interface call succeeds.

  • On failure: Configures the event to trigger when the interface call fails.

Advanced configuration

  • Debounce: Sets a debounce expression to prevent frequent interface calls.

  • Do not run if: Determines whether to execute this integration operation based on a conditional expression.

Manually trigger an integration

Event trigger

  1. In the component where you want to trigger the integration operation, configure an event handler.

  2. Set the action type to Integration Operation and select the integration.

  3. Enter the configured parameters as an object.

API trigger

If the name of the integration operation is action1, you can use the action1.trigger() method to trigger the operation anywhere a script can be executed. If the integration operation has parameters, you must pass them as an object.