ApsaraMQ for RabbitMQ allows you to call API operations by using HTTP, SDKs, and OpenAPI Explorer.
Use HTTP
To call an API operation by using HTTP, you must send an HTTP GET request to the ApsaraMQ for RabbitMQ endpoint. You must also add the request parameters that correspond to the API operation being called. After you call the API operation, the system returns a response. Requests and responses are encoded in UTF-8. ApsaraMQ for RabbitMQ API operations use the RPC protocol. You can call the API operations by sending HTTP GET requests.
The following request syntax is used:
https://Endpoint/?Action=xx&Parameters
Parameter description:
Endpoint: the endpoint that is used to access the ApsaraMQ for RabbitMQ API operation. For more information, see Endpoints.
Action: the API operation that is to be called. For example, to query created ApsaraMQ for RabbitMQ instances, set this parameter to ListInstances.
Version: the version number of the ApsaraMQ for RabbitMQ API. Set the value to 2019-12-12.
Parameters: the request parameters. Separate multiple parameters with ampersands (&).
Request parameters include both common parameters and operation-specific parameters. Common parameters include the API version number and authentication information. For more information, see the following section.
Common parameters
Common request parameters
Parameter | Type | Required | Description |
Format | String | No | The response format. Valid values: JSON and XML. Default value: JSON. |
Version | String | Yes | The version number of the API. Specify the version number in the YYYY-MM-DD format. Set the value to 2019-12-12 |
AccessKeyId | String | Yes | The AccessKey ID that is used to access ApsaraMQ for RabbitMQ. |
Signature | String | Yes | The signature string of the current request. |
SignatureMethod | String | Yes | The encryption method of the signature string. Set this parameter to HMAC-SHA1 |
Timestamp | String | Yes | The timestamp of the request. Specify the value in the ISO 8601 standard in the YYYY-MM-DDThh:mm:ssZ format. The time must be in UTC. Example: 2013-01-10T20:00:00Z, which specifies 20:00:00 on January 10, 2013 (UTC+8). |
SignatureVersion | String | Yes | The version of the signature algorithm. Set this parameter to 1.0 |
SignatureNonce | String | Yes | A unique and random number that is used to prevent replay attacks. You must use different numbers for different requests. We recommend that you use universally unique identifiers (UUIDs). |
ResourceOwnerAccount | String | No | The Alibaba Cloud account to which the resource that you want to access belongs. |
Examples
https://amqp-open.aliyuncs.com/?Action=ListInstances
&Format=JSON
&Version=2019-12-12
&Signature=xxxx%xxxx%3D
&SignatureMethod=HMAC-SHA1
&SignatureNonce=e7b1f31150be45594905ce6d28561286
&SignatureVersion=1.0
&AccessKeyId=key-test
&TimeStamp=2020-02-10T08%3A43%3A05Z
...
Common response parameters
API responses use the HTTP response format. Responses can be returned in the JSON or XML format. You can specify the response format in the request. The default response format is JSON. Every response returns a unique request ID that is indicated by the RequestId parameter, regardless of whether the request is successful.
A
2xx
HTTP status code indicates that the request was successful.A
4xx
or5xx
HTTP status code indicates that the request failed.
Sample responses
XML format
<?xml version="1.0" encoding="utf-8"?> <!--Root node of the response--> <Interface name+Response> <!--Returned request tag--> <RequestId>D6660A81-1A96-43F3-AC00-4EE473C70AEC</RequestId> <!--Returned data--> </Operation name+Response>
JSON format
{ "RequestId":"D6660A81-1A96-43F3-AC00-4EE473C70AEC", /*Returned data*/ }
Use SDKs
ApsaraMQ for RabbitMQ provides SDKs for multiple programming languages. The SDKs automatically sign requests for you. The following table provides the download links and related documentation of ApsaraMQ for RabbitMQ SDKs for different programming languages.
Programming language | Download link | References |
Java | ||
Go | ||
Python | ||
PHP |
Use OpenAPI Explorer
OpenAPI Explorer is a GUI tool for calling API operations. You can use OpenAPI Explorer to call the API operations of Alibaba Cloud services and the API operations provided in Alibaba Cloud API Marketplace. You can call the API operations on a web page or a command-line interface (CLI). You can also use OpenAPI Explorer to view the request and response parameters of each API call. OpenAPI Explorer dynamically generates the sample code for different SDKs. To access OpenAPI Explorer, click OpenAPI Explorer.