Querying All Domain Names Associated with HTTPS Certificates
Function
This API is used to query information about domain names with an HTTPS certificate and their certificates.
-
A single tenant can call this API 15 times per second.
Calling Method
For details, see Calling APIs.
URI
GET /v1.0/cdn/domains/https-certificate-info
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
page_size |
No |
Integer |
Definition Number of records on each page during pagination query. Constraints N/A Range 1 to 10,000. Default Value N/A 30 |
page_number |
No |
Integer |
Definition Page number for pagination query. Constraints N/A Range 1 to 65,535. Default Value 1 |
domain_name |
No |
String |
Definition Acceleration domain name. Constraints N/A Range N/A Default Value N/A |
user_domain_id |
No |
String |
Definition Account ID of the user to which the domain name belongs. For details about how to obtain the value of this parameter, see section "Obtaining the Account ID" in the CDN API Reference. Constraints N/A Range N/A Default Value N/A |
enterprise_project_id |
No |
String |
Definition Enterprise project ID. Obtain the enterprise project ID by calling the ListEnterpriseProject API of EPS. Constraints This parameter indicates the ID of the enterprise project to which the resource to be queried belongs. It is valid only when the enterprise project function is enabled. The value all indicates all projects. Range N/A Default Value N/A |
Request Parameters
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
X-Auth-Token |
Yes |
String |
Definition User token, which can be obtained by calling the IAM API (value of X-Subject-Token in the response header). Constraints N/A Range N/A Default Value N/A |
Response Parameters
Status code: 200
Parameter |
Type |
Description |
---|---|---|
total |
Integer |
Total number of queried records. |
https |
Array of HttpsDetail objects |
HTTPS settings. |
Parameter |
Type |
Description |
---|---|---|
domain_id |
String |
Domain name ID. |
domain_name |
String |
Domain name associated with the certificate. |
cert_name |
String |
Certificate name. |
certificate |
String |
Certificate content. |
private_key |
String |
Private key. |
certificate_type |
Integer |
Certificate type. Possible values: 0 (your own certificate), 1 (Huawei-managed certificate), and 2 (SCM certificate). |
expiration_time |
Long |
Certificate expiration time. |
https_status |
Integer |
Whether HTTPS is enabled. 0: HTTPS is disabled. 1: HTTPS is enabled and the origin protocol is the same as that of user requests. 2: HTTPS is enabled and the origin protocol is HTTP. |
force_redirect_https |
Integer |
Whether force redirect is enabled. Possible values: 0 (no), 1 (yes), and 2 (force HTTP.) |
force_redirect_config |
ForceRedirect object |
Definition This parameter is used to force clients to use HTTPS when accessing CDN PoPs. Constraints N/A |
http2 |
Integer |
Whether HTTP/2 is used. Possible values: 1 (yes) and 0 (no). |
Parameter |
Type |
Description |
---|---|---|
switch |
Integer |
Definition Whether to enable force redirect to force clients to use HTTPS or HTTP to access CDN PoPs. Constraints N/A Range
Default Value N/A |
redirect_type |
String |
Definition Protocol to which requests are forcibly redirected. Constraints If force redirect to HTTPS is enabled, an HTTPS certificate must be configured. Otherwise, the access will fail. Range
Default Value N/A |
Example Requests
GET https://cdn.myhuaweicloud.com/v1.0/cdn/domains/https-certificate-info?domain_name=www.example.com&page_size=10&page_number=1
Example Responses
Status code: 200
OK
{ "total" : 1, "https" : [ { "https_status" : 1, "force_redirect_https" : 2, "force_redirect_config" : { "redirect_type" : "http", "switch" : 1 }, "http2" : 0, "cert_name" : "cdn_test", "certificate" : "-----BEGIN CERTIFICATE-----XX-----END CERTIFICATE-----", "private_key" : null, "certificate_type" : 0, "expiration_time" : 1606187416000, "domain_id" : "3e****************************63", "domain_name" : "www.example.com" } ] }
SDK Sample Code
The SDK sample code is as follows.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
package com.huaweicloud.sdk.test; import com.huaweicloud.sdk.core.auth.ICredential; import com.huaweicloud.sdk.core.auth.GlobalCredentials; import com.huaweicloud.sdk.core.exception.ConnectionException; import com.huaweicloud.sdk.core.exception.RequestTimeoutException; import com.huaweicloud.sdk.core.exception.ServiceResponseException; import com.huaweicloud.sdk.cdn.v2.region.CdnRegion; import com.huaweicloud.sdk.cdn.v2.*; import com.huaweicloud.sdk.cdn.v2.model.*; public class ShowCertificatesHttpsInfoSolution { public static void main(String[] args) { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment String ak = System.getenv("CLOUD_SDK_AK"); String sk = System.getenv("CLOUD_SDK_SK"); ICredential auth = new GlobalCredentials() .withAk(ak) .withSk(sk); CdnClient client = CdnClient.newBuilder() .withCredential(auth) .withRegion(CdnRegion.valueOf("<YOUR REGION>")) .build(); ShowCertificatesHttpsInfoRequest request = new ShowCertificatesHttpsInfoRequest(); try { ShowCertificatesHttpsInfoResponse response = client.showCertificatesHttpsInfo(request); System.out.println(response.toString()); } catch (ConnectionException e) { e.printStackTrace(); } catch (RequestTimeoutException e) { e.printStackTrace(); } catch (ServiceResponseException e) { e.printStackTrace(); System.out.println(e.getHttpStatusCode()); System.out.println(e.getRequestId()); System.out.println(e.getErrorCode()); System.out.println(e.getErrorMsg()); } } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# coding: utf-8 import os from huaweicloudsdkcore.auth.credentials import GlobalCredentials from huaweicloudsdkcdn.v2.region.cdn_region import CdnRegion from huaweicloudsdkcore.exceptions import exceptions from huaweicloudsdkcdn.v2 import * if __name__ == "__main__": # The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. # In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak = os.environ["CLOUD_SDK_AK"] sk = os.environ["CLOUD_SDK_SK"] credentials = GlobalCredentials(ak, sk) client = CdnClient.new_builder() \ .with_credentials(credentials) \ .with_region(CdnRegion.value_of("<YOUR REGION>")) \ .build() try: request = ShowCertificatesHttpsInfoRequest() response = client.show_certificates_https_info(request) print(response) except exceptions.ClientRequestException as e: print(e.status_code) print(e.request_id) print(e.error_code) print(e.error_msg) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
package main import ( "fmt" "github.com/huaweicloud/huaweicloud-sdk-go-v3/core/auth/global" cdn "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cdn/v2" "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cdn/v2/model" region "github.com/huaweicloud/huaweicloud-sdk-go-v3/services/cdn/v2/region" ) func main() { // The AK and SK used for authentication are hard-coded or stored in plaintext, which has great security risks. It is recommended that the AK and SK be stored in ciphertext in configuration files or environment variables and decrypted during use to ensure security. // In this example, AK and SK are stored in environment variables for authentication. Before running this example, set environment variables CLOUD_SDK_AK and CLOUD_SDK_SK in the local environment ak := os.Getenv("CLOUD_SDK_AK") sk := os.Getenv("CLOUD_SDK_SK") auth := global.NewCredentialsBuilder(). WithAk(ak). WithSk(sk). Build() client := cdn.NewCdnClient( cdn.CdnClientBuilder(). WithRegion(region.ValueOf("<YOUR REGION>")). WithCredential(auth). Build()) request := &model.ShowCertificatesHttpsInfoRequest{} response, err := client.ShowCertificatesHttpsInfo(request) if err == nil { fmt.Printf("%+v\n", response) } else { fmt.Println(err) } } |
For SDK sample code of more programming languages, see the Sample Code tab in API Explorer. SDK sample code can be automatically generated.
Status Codes
Status Code |
Description |
---|---|
200 |
OK |
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot