Query List of HTTPS Domain Names

Last updated: 2018-08-13 10:07:37

API Description

This API (GetDsaHttpsHostList) is used to query the list of all domain names with the HTTPS acceleration feature enabled under the account.
Domain name for API request: dsa.api.qcloud.com

Note:
A maximum of 100 calls to this API are allowed per minute. If the limit is exceeded, an error is returned.

Input Parameters

The following request parameter list only provides API request parameters. Common request parameters are required when the API is called. For more information, please see Common Request Parameters page. The Action field for this API is GetDsaHttpsHostList.

Parameter Required Type Description
offset No Unsigned Offset. Default is 0, which means no offset.
length No Unsigned The maximum length. Default is 3,000, which means the information of up to 3,000 domain names is returned.

Note:
This API supports querying the information of up to 3,000 domain names at a time.
If there are a large number of domain names, you can use "offset" and "length" for paged queries.

Output Parameters

Parameter Type Description
code Int Common error code; 0: Successful; other values: Failed. For more information, please see Common Error Codes on the Error Codes page.
message String Module error message description depending on API
codeDesc String Error message or error code at business side
data Object Returned result as described below

data Field Description

Parameter Type Description
hosts array HTTPS configuration information of the domain name as described below in hosts Field Description
total Unsigned Total number of domain names with the HTTPS acceleration feature enabled

hosts Field Description

Parameter Type Description
host_id Int ID of the domain name connected to DSA
host String Accelerated domain name
https Object HTTPS configuration information as described below in HTTPS Field Description

HTTPS Field Description

Parameter Type Description
type Unsigned Indicates whether to enable HTTPS
0: Disable
2: Enable (with "Use HTTP for Origin-Pull" enabled)
4: Enable (with "Use Request Protocol for Origin-Pull" enabled)
cert_id String Tencent Cloud-hosted certificate ID, which is returned when a Tencent Cloud-hosted certificate is used
cn String Certificate domain name
expire String Expiration time of the SSL certificate
message String Certificate remarks
http2 String Indicates whether to enable HTTP 2.0
on: Enable
off: Disable
redirection String Indicates whether to enable "Force Redirect to HTTPS"
on: Enable
off: Disable

Note:
If "Force Redirect to HTTPS" is enabled, DSA acceleration nodes will force the client to redirect HTTP requests to HTTPS requests.

Sample Code

Configuration example

Obtain the list of all domain names with the HTTPS acceleration feature enabled.

GET request

https://dsa.api.qcloud.com/v2/index.php?
Action=GetDsaHttpsHostList   
&SecretId=XXXXXXXXXXXXXXXXXXXXXXXXX   
&Timestamp=1462440051   
&Nonce=123456789   
&Signature=XXXXXXXXXXXXXXXXXXXXXXXXXX

POST request

For a POST request, the parameters are input in HTTP Request-body. The request address is:

https://dsa.api.qcloud.com/v2/index.php

Formats such as form-data and x-www-form-urlencoded are supported for the parameters. The array of parameters is as follows:

array (
  'Action' => 'GetDsaHttpsHostList',
  'SecretId' => 'SecretId',
  'Timestamp' => 1462782282,
  'Nonce' => 123456789,
  'Signature' => 'Signature'
)

Example of returned result

  1. Query successful
    {
    "code": 0,
    "message": "",
    "codeDesc": "Success",
    "data": {
        "hosts": [
            {
                 "host_id": XXXX,
                "host": "dsatest1.qcloud.com",
                "https": {
                    "type":"2",
                    "cert_id":"K9FAhubv",
                    "message":"",
                    "cn":"*.qcloud.com",
                    "expire":"2018-08-24 07:59:59"
                    }
            },
            {
                "host_id": XXXX,
                "host": "dsatest2.qcloud.com",
                "https": {
                    "type":"4",
                    "cert_id":"K9FAhubv",
                    "message":"",
                    "cn":"*.qcloud.com",
                    "expire":"2018-08-24 07:59:59"
                    }
            },
            {
                "host_id": XXXX,
                "host": "dsatest3.elliotxing.com",
                "https": {
                    "type":"4",
                    "message":"",
                    "cn":"*.elliotxing.com",
                    "expire":"2018-08-24 07:59:59"
                    }
            }
        ],
        "total": 3
    }
    }
    
  2. Query failed
    {
    "code": 4100,
    "message": "Authentication failed. For more information, please see the Authentication section in the document.",
    "codeDesc": "AuthFailure"
    }