After an API is published, you can call the API in applications by using an SDK that is downloaded from API Gateway. This topic describes how to call an API in an application.
- An API is published. Only published APIs can be called.
- An application is created. APIs 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 APIs. For each API, a default application is created and an identity is assigned for the API owner to call the API in the default application.
- The application is authorized to call the API. When an API is published, Data Management (DMS) automatically authorizes the default application of the API owner to call the API.
- Go to the Authorized API SDK page in the API Gateway console.
- Find the application named DMS_DEFAULT_APP and click the buttons in the SDK column to download SDKs and documentation in various
programming languages. DMS_DEFAULT_APP is the default application that is automatically
created by the data service module of DMS. The programming languages include Java
and development languages for operating systems such as iOS and Android. Note
- To download SDKs and documentation in other programming languages such as PHP, Node.js, Python, and .NET, see the Call Examples in Other Programming Languages (for Reference Only) section.
- 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 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 to use API Gateway, see Use RAM to manage user permissions for API Gateway.
- 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 APIs 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 APIs 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. This authentication method has a high security level. For more information about how to generate a signature for calling an API in an application, see Call an API.
- Obtain permissions to call the API. Note
- If you own the API, skip this step. DMS automatically authorizes your default application to call the API when the API is published.
- If the API that you want to call is owned by others, obtain permissions to call the API. For more information, see Authorize an application to call an API operation.
- Use an SDK to call the API in the application.