Based on the SDKs provided by the API Gateway, you can write codes to call an API. API Gateway provides SDKs of the mainstream languages for the Web client and mobile client and continuously provides SDKs of more language types. You can also edit an HTTP request to call an API.
Through the preceding steps, you can obtain the domain name, path, and parameter description from the service provider. The created app is used as your requester identity. The AppKey and AppSecret are used for calculating the encrypted signature. The demo link for signature calculation is as follows:
After your app has been authorized, you can call the API. The API request structure is as follows:
//If the service address 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:
POST HttpMethod: POST
//Headers must include signature information and certain parameters.
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
When you call an API, either the HTTP or HTTPS request must include signature information. The AppKey indicates your identity. The AppSecret is the key used to encrypt the signature string and verify the signature string on the server. For more information about the methods of calculating and passing the encrypted signature, see Portal and Protocol.
For more information, see User Manual (Call an API).