Call an API

Last Updated: May 17, 2017

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

//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.

  1. POST HttpMethod: POST

//Headers shall include signature information and certain parameters.

//For details about the methods of calculating and passing the encrypted signature, refer to Portal and Protocol.

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

//Standard HTTP header.

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

//Body content.

  1. Amount=11&InstanceId=ClientInstanceId&InstanceName=ClientInstanceName

An API request is constructed through the above content and the inputted parameters of the API. At the public beta stage, you need to 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 details, see subsequent content.

Thank you! We've received your feedback.