OpenAPI styles
This topic describes the RPC and ROA styles for OpenAPI. To make a custom request, you must know the API style of the service you want to call. The API style determines how you structure the HTTP method, request header, query string, and request body.
Alibaba Cloud services use two OpenAPI styles: RPC and ROA.
RPC style
Remote Procedure Call (RPC) is a protocol that allows a program to call a function or method in another program as if it were a local call.
In an RPC style API, a client communicates with a server by using function or method calls, not by manipulating resources.
RPC style APIs support the GET and POST HTTP methods.
OpenAPI is for RPC-style products, such as Elastic Compute Service (ECS), ApsaraDB RDS, and Content Delivery Network (CDN).
Example:
http://ecs.aliyuncs.com/?SignatureVersion=1.0&Action=DescribeDedicatedHosts&Format=XML&SignatureNonce=3ee8c1b8-xxxx-xxxx-xxxx-xxxxxxxxx&Version=2014-05-26&AccessKeyId=testid&Signature=OLeaidS1JvxuMvnyHOwuJ%2BuX5qY%3D&SignatureMethod=HMAC-SHA1&Timestamp=2016-02-23T12%3A46%3A24Z&RegionId=cn-hangzhou&Status=Available
ROA style
Representational State Transfer (REST) is an architectural style for designing web services. A RESTful API allows a client application to interact with a server through HTTP requests, using HTTP methods like GET, POST, PUT, and DELETE to perform create, read, update, and delete (CRUD) operations.
Resource-Oriented Architecture (ROA) is a resource-based architectural style and an extension of REST.
ROA style APIs support the following HTTP methods:
-
GET: Retrieves a resource from the server. This method does not modify the state of resources on the server.
-
POST: Sends data to the server to create a new resource or to perform a specific action.
-
PUT: Updates a resource on the server. The client must provide the complete data for the resource.
-
DELETE: Deletes a resource from the server.
OpenAPI is used for ROA-style products such as Application Real-Time Monitoring Service (ARMS), Batch Compute, Container Service for Kubernetes (ACK), and Elasticsearch.
POST /clusters/test_cluster_id/triggers HTTP/1.1
{
"x-acs-action":"CreateTrigger",
"x-acs-version":"2015-12-15",
"Accept":"application/json",
"Authorization": "acs testid:D9uFJAJgLL+dryjBfQK+YeqGtoY=",
"x-acs-signature-nonce":"15215528852396",
"Date":"Tue 9 Apr 2022 07:35:29 GMT",
"x-acs-signature-method":"HMAC-SHA1",
"Content-MD5":"Gtl/0jNYHf8t9Lq8Xlpaqw=="
"Host":"cs.aliyuncs.com"
}
{
"cluster_id":"test_cluster_id",
"project_id":"default/nginx-test",
"action":"redeploy",
"type":"deployment"
}
Check the API style
Go to the API Reference section of a cloud product's documentation in the Help Center and view the API Overview document, which describes the API style used by the OpenAPI. For example, to view the API Overview document for Elastic Compute Service (ECS), select Developer Guide > API Reference (ECS) > API Overview in the left navigation bar of the Alibaba Cloud Help Center. The page provides a description of the signature style: The OpenAPI for this product (Elastic Compute Service ECS/2014-05-26) uses the RPC signature style.