edit-icon download-icon

Introduction to Alibaba Cloud API

Last Updated: Mar 12, 2018

Alibaba Cloud offers two different types of APIs: RPC APIs and REST APIs. The calling method is different for each API type.

For both API types, you must sign the API request when manually calling an API. However, if you use the Alibaba Cloud SDK to call APIs, the SDK will automatically sign the request according to the configured AccessKey. For more information about signature, see Sign RPC APIs and Sign REST APIs.

RPC APIs

A Remote Procedure Calling (RPC) is initiated by the client. The client sends a request by calling a method or function to a server with supplied parameters to execute an operation.

In general, the API that requires the Action parameter belongs to the RPC type. The APIs of products like Elastic Compute Service, ApsaraDB for RDS, Server Load Balancer, CDN, and many other products are all RPC APIs.

The structure of an RPC request is as follows:

http://endpoint/?Action=xx&parameters

or

https://endpoint/?Action=xx&parameters

where:

  • Endpoint is the entry of the Alibaba Cloud service to call. For example: ecs.aliyuncs.com.

  • Action is the operation to perform. For example, use StartInstance to start an ECS instance.

  • Parameters are request parameters separated by ampersands (&).

    Request parameters consist of common required parameters and API specific parameters. Common required parameters include VPI version, credentials and so on. For more information, see Common Required Parameters for RPC APIs.

Request example

The following example is a request that starts an ECS instance:

  1. https://ecs.aliyuncs.com/?AccessKeyId=TMP.AQGqjJJdy-rmgAX0iRI2Y589wtyzHMVdjnTVh6vW0rJ0DQ79du2xlEBCpygaAAAwLAIUF9HjqujiJpOUG32aL6GRbPNUV_oCFDi0R2vPp6cxAHobAJywEKQm8nkm&Action=StartInstance&Format=JSON&InstanceId=i-instance1&SecureTransport=true&SignatureMethod=HMAC-SHA1&SignatureNonce=3decf28966fc49db29e62164261c6d2b&SignatureVersion=1.0&SourceIp=106.11.34.12&Timestamp=2018-02-27T02%3A34%3A37Z&Version=2014-05-26&Signature=RdQdz%2BO4zIy88DRaqv1Nd3NyQzY%3D

To make the example easier to read, the request examples are displayed as follows in the Alibaba Cloud documentation:

  1. https://ecs.aliyuncs.com/?Action=StartInstance
  2. &InstanceId=i-instance1
  3. &<CommonRequiredParameters>

REST APIs

Representational State Transfer (REST) is an architectural style for designing web applications.

The APIs of products like Resource Orchestration Service and Container Service are REST APIs.

The structure of a REST request is as follows:

HTTP_method/URI<parameters>

where:

  • HTTP_method is the HTTP method to use. For example: PUT, POST, GET, and DELETE.

  • URI is the identifier of the web resource to call. For example: /cluster.

  • Parameters are request parameters.

    Request parameters consist of common required parameters and API specific parameters. Common required parameters include VPI version, credentials and so on. For more information, see Common Required Parameters for REST APIs.

Request example

The following example is a request that searches all the clusters:

  1. GET /clusters/C5b5e80b0b64a4bf6939d2d8fbbc5ded7 HTTP/1.1
  2. <CommonRequiredParameters>
Thank you! We've received your feedback.