After an API operation is published, you can call the API operation in applications by using an SDK that is downloaded from API Gateway. This topic describes how to call an API operation in an application.

Prerequisites

  • An API operation is published. Only published API operations can be called.
  • An application is created. API operations are called in applications. Therefore, you must create an application in API Gateway. The application can be assigned an identity that you can use to call API operations. For each API operation, a default application is created and an identity is assigned for the API owner to call the API operation in the default application. For more information about applications, see Manage applications.
  • The application is authorized to call the API operation. When an API operation is published, Data Management (DMS) automatically authorizes the default application of the API owner to call the API operation.

Procedure

  1. Go to the Authorized APIs SDK Auto-Generation page in the API Gateway console.
  2. Find the application named DMS_DEFAULT_APP and click the buttons in the Authorized APIs SDK Auto-Generation column to download SDKs and documentation in various coding languages. DMS_DEFAULT_APP is the default application that is automatically created by the data service module of DMS. The coding languages include Java and development languages for operating systems such as iOS and Android.
    Note
    • To download SDKs and documentation in other coding languages such as PHP, Node.js, Python, and .NET, see call examples in the Other Language Example section.
    • To download SDKs and documentation for API operations that are purchased and authorized by using other channels such as Alibaba Cloud API Marketplace, see Obtain API documentation.
    • To use API Gateway, a RAM user must be authorized by the Alibaba Cloud account to which the RAM user belongs. API Gateway provides two authorization policies. The AliyunApiGatewayFullAccess policy is used to grant management permissions, and the AliyunApiGatewayReadOnlyAccess policy is used to grant read-only permissions. For more information about how to authorize RAM users, see Use RAM to manage user permissions for API Gateway.
  3. Go to the Data Service tab in the DMS console. On the API Call tab, find the identity information that you want to use in the API call authentication method section.
    Note
    • Simple identity authentication requires only an AppCode. This authentication method is suitable for calling API operations by using URLs instead of in programming environments. This authentication method has a low security level and is generally used in scenarios in which data visualization is involved, such as calling API operations in DataV.
    • Encrypted signature identity authentication requires an AppKey and an AppSecret, which are used to dynamically generate an encrypted signature for calling an API operation. This authentication method has a high security level. For more information about how to generate a signature for calling an API operation in an application, see Call an API operation.
  4. Obtain permissions to call the API operation.
    Note
    • If you own the API operation, skip this step. DMS automatically authorizes your default application to call the API operation when the API operation is published.
    • If the API operation that you want to call is owned by others, obtain permissions to call the API operation. For more information, see Obtain permissions.
  5. Use an SDK to call the API operation in the application.