edit-icon download-icon

Call an API

最終更新日: Apr 04, 2018

You can use API Gateway to call the API services enabled by other Alibaba Cloud users or third-party service providers. API Gateway provides for you a series of management services and support.

Call example

Based on the SDKs provided by API Gateway, you can write codes to call an API. You can also edit an HTTP request to call an API. The request structure of the API is as follows:

//If the domain name is a13db7999e494a90819cce500130034d.com.

//If the path is /web/cloudapi/mapping/service.

//If the query content is a=name, b=12.

//Then the URL of the request is as follows:


//Requesting method.

POST HttpMethod: POST      

//Headers must include signature information and certain parameters.

//For more information about the methods of calculating and passing the encrypted signature, see Portal and Protocol.

X-Ca-Version:  1      // API version
X-Ca-Signature-Headers:  X-Ca-Version,X-Ca-Key,X-Ca-Stage,X-Ca-Timestamp      // Headers involved in signature calculation
X-Ca-Key:  60028305      //AppKey
X-Ca-Stage:  test      //Stage
X-Ca-Timestamp:  1456905123049        //Time stamp
X-Ca-Signature:  UAaH/qteir4G9UK4YR+NWdyq+c1rjl0PvtO/C1Qo68U=      // Signature

//Standard HTTP header.

Host:  a13db7999e494a90819cce500130034d.com         //Service address
Date:  Wed  02  Mar  2016  07:52:02  GMT    
User-Agent:  Apache-HttpClient/4.1.2  (java  1.6)    
Content-Type:  application/x-www-form-urlencoded;  charset=utf-8    

//Body content.


An API request is constructed through the preceding content and the inputted parameters of the API. At the public beta stage, you must obtain API documentation and details, such as the service address and path, in the deprecation environment from the API service provider. The AppKey is the key for the created app, which is used for identity verification. The app is your identity to call an API. For more information, see subsequent content.