To send a Dedicated Host (DDH) API request, you can send an HTTP GET request to the DDH endpoint. You must add the request parameters that correspond to the API operation being called. After you call the API, the system returns a response. The request and response are encoded in UTF-8.

Request syntax

DDH API operations use the RPC protocol. You can call DDH API operations by sending HTTP GET requests.

The request syntax is as follows:
http://Endpoint/?Action=xx&Parameters
where:
  • Endpoint: the endpoint of the DDH API is ecs.aliyuncs.com.
  • Action: the name of the operation being performed. For example, to query the details of one or more dedicated hosts, you must set the Action parameter to DescribeDedicatedHosts.
  • Version: the version of the API. The DDH API version is 2014-05-26.
  • Parameters: the request parameters for the operation. Separate multiple parameters with ampersands (&).

    Request parameters include both common parameters and operation-specific parameters. Common parameters include the API version number and identity verification information. For more information, see Common parameters and Signature method.

The following sample calls the DescribeDedicatedHosts operation to query the details of the dedicated hosts in a region.
Note The sample requests in the DDH API reference are formatted for better readability.
https://ecs.aliyuncs.com/?Action=DescribeDedicatedHost
&Format=xml
&Version=2014-05-26
&Signature=xxxx%xxxx%3D
&SignatureMethod=HMAC-SHA1
&SignatureNonce=15215528852396
&SignatureVersion=1.0
&AccessKeyId=key-test
&TimeStamp=2012-06-01T12:00:00Z
&RegionId=cn-hangzhou
...

Responses

Responses can be returned in either the JSON or XML format. The default response format is XML. To change the format of the response, you can specify the Format common parameter in the request. For more information, see Common parameters. The response samples provided in DDH API Reference are formatted with newlines and indentations for better readability. However, the actual responses do not provide such formatting.

API responses use the HTTP response format. A 2xx status code indicates a successful call. Examples:
  • XML format
    <? xml version="1.0" encoding="UTF-8"? > <! --The root node of the response -->
    <ActionResponse> <! --Returned request ID-->
        <RequestId>4C467B38-3910-447D-87BC-AC049166F216</RequestId> <! --Response data-->
    </ActionResponse>
  • JSON format
    {
        "RequestId": "4C467B38-3910-447D-87BC-AC049166F216" /* Response data */
    }
A 4xx or 5xx status code indicates a failed call. Examples:
  • XML format
    <? xml version="1.0" encoding="UTF-8"? ><! --The root node of the response -->
    <Error>
        <RequestId>540CFF28-407A-40B5-B6A5-74Bxxxxxxxxx</RequestId> <! -- Request ID -->
        <HostId>ecs.aliyuncs.com</HostId> <! -- Service endpoint -->
        <Code>MissingParameter.CommandId</Code> <! -- Error code -->
        <Message>The input parameter "CommandId" that is mandatory for processing this request is not supplied. </Message> <! -- Error message -->
    </Error>
  • JSON format
    {
        "RequestId": "540CFF28-407A-40B5-B6A5-74Bxxxxxxxxx", /* Request ID */ 
        "HostId": "ecs.aliyuncs.com",/* Service endpoint */
        "Code": "MissingParameter.CommandId",/* Error code */
        "Message": "The input parameter "CommandId" that is mandatory for processing this request is not supplied." /* Error message */
    }

If an error occurs when you call an API operation, you can troubleshoot the error based on the returned error code. For more information, see Common error codes and API Error Center. If you require further assistance, you can submit a ticket and provide additional details including the endpoint HostId and RequestId.