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.
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:
Endpointis the entry of the Alibaba Cloud service to call. For example:
Actionis the operation to perform. For example, use
StartInstanceto start an ECS instance.
Parametersare 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.
The following example is a request that starts an ECS instance:
To make the example easier to read, the request examples are displayed as follows in the Alibaba Cloud documentation:
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_methodis the HTTP method to use. For example: PUT, POST, GET, and DELETE.
URIis the identifier of the web resource to call. For example:
Parametersare 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.
The following example is a request that searches all the clusters:
GET /clusters/C5b5e80b0b64a4bf6939d2d8fbbc5ded7 HTTP/1.1