Use the DescribeCertificateState operation to query the application status of a domain validated (DV) certificate.
Review the OpenAPI documentation
The API overview shows that DescribeCertificateState is the operation for querying DV certificate application status. Review its documentation for required parameters and permissions.
Create a RAM user and grant permissions
Identity
You can call this API with an Alibaba Cloud account, a RAM user, or a RAM role (Identity, credential, and authorization). This example uses a RAM user.
Log on to the RAM console and create a RAM user with API-only permissions. Record the AccessKey pair. Create a RAM user.
Authorization
-
Go to the RAM user list. In the Actions column, click Attach Policy.
-
In the Policy section, search for and select AliyunYundunCertFullAccess (full access to Alibaba Cloud Security Certificate Service), then click OK.
Credential
An AccessKey pair is generated when you create a RAM user. To create a new one, go to the RAM user details page, click the Authentication tab, then click Create AccessKey. Create an AccessKey.
Call the OpenAPI
This example uses Java.
Prepare the Java development environment
Requirements
-
JDK 1.8 or later. Download JDK 1.8
-
IntelliJ IDEA. Download IntelliJ IDEA
Verify the version
Run java -version in a terminal to verify the JDK version.
Configure environment variables
To avoid hard-coding AccessKey credentials in source code, store them in environment variables. Configure environment variables on Linux, macOS, and Windows.
Install dependencies
SDK dependency
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>cas20200407</artifactId>
<version>1.0.13</version>
</dependency>
Authentication dependency
Use the latest version of the Credentials Java library.
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>credentials-java</artifactId>
<version>LATEST</version>
</dependency>
Download the sample code
-
Go to the DescribeCertificateState API debugging page in OpenAPI Explorer.
-
Enter the OrderId of the certificate application order to query.
-
Click Download full project to download the Java sample code package.

-
Extract the package and import the project in IntelliJ IDEA.
Run the code
Run the code in IntelliJ IDEA. Expected output:
{
"Type": "domain_verify",
"Domain": "www.example.com",
"RecordType": "TXT",
"Certificate": "-----BEGIN CERTIFICATE----- …… -----END CERTIFICATE-----",
"RequestId": "082FAB35-6AB9-4FD5-8750-D36673548E76",
"RecordDomain": "_dnsauth",
"PrivateKey": "-----BEGIN RSA PRIVATE KEY-----…… -----END RSA PRIVATE KEY-----",
"ValidateType": "FILE",
"RecordValue": "20200420000000223erigacv46uhaubchcm0o7spxi7i2isvjq59mlx9lucnkqcy",
"Content": "http://example.com/.well-known/pki-validation/fileauth.txt",
"Uri": "/.well-known/pki-validation/fileauth.txt"
}