You can call APIs opened by others in APIG.
Before calling an API, ensure that the network of your service system can communicate with the API access domain name or address.
Obtain API calling information from the API provider before you call an API.
On the APIG console, choose API Management > APIs. On the APIs page, obtain the domain name, request method, and request path of the desired API. Click the API name to go to the APIs tab page, and obtain the basic information in the Frontend Configuration and Backend Configuration areas.
Obtain the request authentication information according to the API's authentication mode.
Authentication Mode | Authentication Information |
|---|---|
App (signature) | Obtain the key and secret of a credential authorized for the API from the API provider, as well as the signing SDK. |
App (simple authentication) | Obtain the AppCode of a credential authorized for the API from the API provider. |
App (two-factor) | Obtain the information required for both app and custom authentication. |
App (app_secret) | Obtain the key and secret of a credential authorized for the API from the API provider. |
App (app_basic) | Obtain the key and secret of a credential authorized for the API from the API provider. |
IAM (token) | Obtain the username and password for the cloud platform. |
IAM (AK/SK) | Obtain the AK/SK of an account for the cloud platform and the signing SDK. |
IAM (two-factor) | Obtain the information required for both IAM and custom authentication |
Custom | Obtain the custom authentication information to carry in request parameters from the API provider. |
None | No authentication information required. |
Third-party authorizer (API policy) | Obtain third-party authorizer information to carry in request parameters from the API provider. |
If App authentication is used, choose API Management > Credentials on the APIG console. Click the name of a credential authorized for the target API, and obtain the key and secret on the credential details page.
If App (signature) or IAM (AK/SK) authentication is used, log in to the APIG console, choose Help Center, and download the SDK of the corresponding language on the Using SDKs tab page.
If App (signature) or IAM (AK/SK) authentication is used, choose API Management > Credentials on the APIG console. Click the name of a credential authorized for the target API, and obtain an AppCode in the AppCodes area of the credential details page.
This section describes only the configuration of the request path and authentication parameters. For other parameters, such as timeout and SSL, configure them as required. To avoid service loss due to incorrect parameters, configure them by referring to the industry standards.
API calling supports persistent connections. But you should use persistent connections properly to avoid occupying too many resources.
POST https://{Address}/{Path}?{Query}{Header}{{Body}}
Scenario | Request Parameter Configuration |
|---|---|
Calling an API with a domain name | Call an API using the debugging domain name allocated to the API group or a domain name bound to the group. No additional configuration is required. |
Calling an API in the DEFAULT group with an IP address | Call an API in the DEFAULT group with an IP address. No additional configuration is required. |
Calling an API in a custom group with an IP address |
|
Authentication Mode | Request Parameter Configuration |
|---|---|
App (signature) | Use the SDK to sign API requests. For details, see section "Calling APIs Through App Authentication" in the API Gateway Developer Guide. |
App (simple authentication) | Add the header parameter X-Apig-AppCode and set the parameter value to the AppCode obtained in Obtaining API Calling Information. For details, see Getting Started. |
App (app_secret) |
|
App (app_basic) |
|
App (two-factor) | Add the information required for both app and custom authentication to the API request. |
IAM (token) | Obtain a token from the cloud platform and add the header parameter X-Auth-Token with the token as the value. For details, see section "Token Authentication" in the API Gateway Developer Guide. |
IAM (AK/SK) | Use the obtained SDK to sign the API request. For details, see section "AK/SK Authentication" in the API Gateway Developer Guide. |
IAM (two-factor) | Add the information for both IAM and custom authentication to the API request. |
Custom | Add the information required for custom authentication to the API request. |
None | No authentication information required. |
Third-party authorizer (API policy) | Obtain third-party authorizer information to carry in request parameters from the API provider. |