tencent cloud

Feedback

CreateCertificate

Last updated: 2023-07-13 15:25:43

1. API Description

Domain name for API request: gaap.tencentcloudapi.com.

This API (CreateCertificate) is used to create the GAAP certificates and configuration files, including basic authentication configuration files, client CA certificates, server SSL certificates, GAAP SSL certificates, and origin server CA certificates.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: CreateCertificate.
Version Yes String Common Params. The value used for this API: 2018-05-29.
Region No String Common Params. This parameter is not required.
CertificateType Yes Integer Certificate type. Where:
0: Basic authentication configuration;
1: Client CA certificate;
2: Server SSL certificate;
3: Origin server CA certificate;
4: Connection SSL certificate.
CertificateContent Yes String Certificate content. URL encoding. Where:
If the certificate type is basic authentication, enter username/password pair for this parameter. Format: “username:password”, for example, root:FSGdT. The password is htpasswd or openssl, for example, openssl passwd -crypt 123456.
When the certificate type is CA/SSL certificate, enter the certificate content for this parameter in the format of ‘pem’.
CertificateAlias No String Certificate name
CertificateKey No String URL-encoded key content. This parameter is required only when the certificate type is SSL certificate. Its format is PEM.

3. Output Parameters

Parameter Name Type Description
CertificateId String Certificate ID
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Creating a certificate

Input Example

POST / HTTP/1.1
Host: gaap.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateCertificate
<Common request parameters>

{
    "CertificateType": "2",
    "CertificateAlias": "xxx",
    "CertificateKey": "%0A-----BEGIN%20RSA%20PRIVATE%20KEY-----%0Axxxxxxxxxxx%0A-----END%20RSA%20PRIVATE%20KEY-----%0A",
    "CertificateContent": "%0A-----BEGIN%20CERTIFICATE-----%0AMIIFmDCCBICgAwIBAgIQC6TGAPV%2B4MO7NIhlkkKFljANBgkqhki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j%0AZXJ0LmNvbS9EaWdpQ2VydEdsb2JhbFJvb3RDQS5jcmwwTAYDVR0gBEUwQzA3Bglg%0AhkgBhv1sAQIwKjAoBggrBgEFBQcCARYcaHR0cHM6Ly93d3cuZGlnaWNlcnQuY29t%0AL0NQUzAIBgZngQwBAgEwDQYJKoZIhvcNAQELBQADggEBAK3dVOj5dlv4MzK2i233%0AlDYvyJ3slFY2X2HKTYGte8nbK6i5/fsDImMYihAkp6VaNY/en8WZ5qcrQPVLuJrJ%0ADSXT04NnMeZOQDUoj/NHAmdfCBB/h1bZ5OGK6Sf1h5Yx/5wR4f3TUoPgGlnU7EuP%0AISLNdMRiDrXntcImDAiRvkh5GJuH4YCVE6XEntqaNIgGkRwxKSgnU3Id3iuFbW9F%0AUQ9Qqtb1GX91AJ7i4153TikGgYCdwYkBURD8gSVe8OAco6IfZOYt/TEwii1Ivi1C%0AqnuUlWpsF1LdQNIdfbW3TSe0BhQa7ifbVIfvPWHYOu3rkg1ZeMo6XRU9B4n5VyJY%0ARmE%3D%0A-----END%20CERTIFICATE-----%0A"
}

Output Example

{
    "Response": {
        "RequestId": "c7bfcad5-3f20-472f-9afc-13a66faebad8",
        "CertificateId": "cert-xxx"
    }
}

Example2 Adding a server SSL certificate

Input Example

POST / HTTP/1.1
Host: gaap.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateCertificate
<Common request parameters>

{
    "CertificateType": "2",
    "CertificateAlias": "123",
    "CertificateKey": "-----BEGIN RSA PRIVATE KEY-----\nMIIEowIBAAKCAQEAn7CUY5bRNtt/YVT9BBDtfyqmF09KXzI+BCrIvrGDrjxRdIsT\nHs0xZL5EbZXt7uc5leXJ47RnVAQtNMCOuqeYtFWNMzGydVchMkImBHEsATE+ukqs\n7qUSmbg/BjlOD4hmPNmNz6eljrwMXxNxP0D0BdDMuy+JPLxDp/Hp/Sr3rngL6cbu\nAvfhnN/l+HvII79KC9D6w8uIyRoAqybaLrP9P+6yXaBFKzdc7o/LanHEAUaxY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C9+Gc3+X4e8gjv0oL0PrD\ny4jJGgCrJtous/0/7rJdoEUrN1zuj8tqccQBRrFj89t0/7ccUY27kOJQeikUfOOX\nkqvYYJYMv03lUwjfofhQXjTC+uOdrUFZzx6bnNXNqKwtuPmlkxFNfYqkx90OW6JP\n+HM8ezUTHiHQcZRDAgMBAAEwDQYJKoZIhvcNAQEFBQADggEBAGKJdazyji4aSAAk\ndcH9/he1RhfkdkBinNQspYWrl7n3+YfX2aCBwkHDTnUUA+HIpUtaWekRqRGHXaKg\nMjSKOHW715VVR3CMekIRkhQkBMmicaC2YRTpJNOOkehAqeszytDXoICgDc34zkmy\nVBPRYckYnXE8gwmew1Ogg8PxeC2WgNAQtm/GXmdfe8Wtoy88Ugz8NSV//lIkQJkM\nzc7+GvWbIsfP7i7Cz8pIMNuJsfrVerbDpbpSSXr6lvTfeCbh9Sq43jpJTbhg2BoU\nSpnKCvccuOEJnGOwb9WyZ/vrO2JG2RUdglpKh6l5c4+33yOgPqEcGnqMqsDDjAct\nGjxzvQ4"
}

Output Example

{
    "Response": {
        "RequestId": "bdef4308-69b2-4941-aeeb-9612f2c0cb2a",
        "CertificateId": "cert-li3tu2id"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
AuthFailure CAM signature/authentication error.
AuthFailure.NotEnterpriseAuthorization Not an organizational customer.
AuthFailure.UnauthorizedOperation The sub-account is not authorized for this operation.
FailedOperation.UserNotConfirmProtocol Protocol not activated.
InternalError Internal error.
InvalidParameter Incorrect parameter.
InvalidParameterValue Incorrect parameter value.
InvalidParameterValue.CertificateContentNotMatchKey Mismatch between the certificate and the private key
InvalidParameterValue.InvalidCertificateContent Failed to resolve. Please check the format of certificate content.
InvalidParameterValue.InvalidCertificateKey Failed to resolve. Please check the format of certificate key.
MissingParameter Missing parameter.
ResourceUnavailable.AccountViolation Restricted resources found in your account. Check your inbox and email for details.
UnauthorizedOperation Unauthorized operation.
UnknownParameter Unknown parameter.
UnsupportedOperation Unsupported operation