Creating a Certificate¶
Function¶
This API is used to create a certificate.
URI¶
POST /v1/{project_id}/waf/certificate
Parameter | Mandatory | Type | Description |
---|---|---|---|
project_id | Yes | String | Project ID |
Request Parameters¶
Parameter | Mandatory | Type | Description |
---|---|---|---|
X-Auth-Token | Yes | String | User token. It can be obtained by calling the IAM API (value of X-Subject-Token in the response header). |
Content-Type | Yes | String | Content type. Default value: application/json;charset=utf8 Default: application/json;charset=utf8 |
Parameter | Mandatory | Type | Description |
---|---|---|---|
name | Yes | String | Certificate name. Only digits, letters, hyphens (-), underscores (_), and periods (.) are allowed. The value can contain a maximum of 256 characters. |
content | Yes | String | Certificate file. Only certificates and private key files in PEM format are supported, and the newline characters in the file must be replaced with \n. |
key | Yes | String | Certificate private key. Only certificates and private key files in PEM format are supported, and the newline characters in the files must be replaced with \n. |
Response Parameters¶
Status code: 200
Parameter | Type | Description |
---|---|---|
id | String | Certificate ID |
name | String | Certificate name |
expire_time | Long | Timestamp when the certificate expires (unit: ms). |
timestamp | Long | Timestamp when the certificate is uploaded |
cert_type | String | Certificate type. This parameter is redundant and can be ignored. |
Status code: 400
Parameter | Type | Description |
---|---|---|
error_code | String | Error code |
error_msg | String | Error message |
Status code: 401
Parameter | Type | Description |
---|---|---|
error_code | String | Error code |
error_msg | String | Error message |
Status code: 500
Parameter | Type | Description |
---|---|---|
error_code | String | Error code |
error_msg | String | Error message |
Example Requests¶
POST https://{Endpoint}/v1/{project_id}/waf/certificate?
{
"name" : "demo",
"content" : "-----BEGIN CERTIFICATE-----\nMIICUjCCAbugAwIBAgIJANxRp4YpWj66MA0GCSqGSIb3DQEBCwUAMEIxCzAJBgNV BAYTAlhYMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNVBAoME0RlZmF1bHQg Q29tcGFueSBMdGQwHhcNMjMwMzA2MTMwNDI2WhcNMjQwMzA1MTMwNDI2WjBCMQsw CQYDVQQGEwJYWDEVMBMGA1UEBwwMRGVmYXVsdCBDaXR5MRwwGgYDVQ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o3mj+VNzeYvoHII9DP28IyBAkEA1DnSyH7D5W4GUmsr NfDOBYuKUaahDtdN/Qx2JF1jEvLluLC7Nr1ETzrKodN/+lOYwfIOWx5tkXPpLFMu rko+xwJAWV7DEf+yn7L2loSWWbknsu7y80y5oALJ3hXVTGNP1H4zzChPLFLD9qzN rbPo25ZjCbcn23YSvWRBnAKKCTTagQJBAKWvgxVOimfrLvpXesPA/Ucs+s7mNSVe CCAAA5g+ZGPdyGUZbP++Yb8tWhdfBLINY9w+uuB+b/I3uRoG0xH1Gu8CQQCpEIYC DUNO98ylm4QOAkyC0nv6x33gQqcu6ExtK7ptbdFZT1QdOAwm5SBaE50rWjyTO4gL Cpsd6f0baeGAxNAw\n-----END PRIVATE KEY-----"
}
Example Responses¶
Status code: 200
Request succeeded.
{
"id" : "6e2be127b79f4a418414952ad5d8c59f",
"name" : "certificatename94319",
"content" : "-----BEGIN CERTIFICATE-----\nMIIB+TCCAaOgAwIBAgIUJP9I8OupQ77w0bGL2yWOQXreM4kwDQYJKoZIhvcNAQELBQAwUTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxDzANBgNVBAoMBkh1YXdlaTEcMBoGA1UEAwwTd2FmLmh1YXdlaWNsb3VkLmNvbTAeFw0yMDA3MDkwNTQ2MDRaFw0yMDA4MDgwNTQ2MDRaMFExCzAJBgNVBAYTAkFVMRMwEQYDVQQIDApTb21lLVN0YXRlMQ8wDQYDVQQKDAZIdWF3ZWkxHDAaBgNVBAMME3dhZi5odWF3ZWljbG91ZC5jb20wXDANBgkqhkiG9w0BAQEFAANLADBIAkEA0UEbMzbvgOJTKrKcDUw9xjFqxM7BaQFM3SLsQlmD5hkzygyL1ra+cWajPJlTCxz9Ph6qldna2+OrIuTdvCcpjwIDAQABo1MwUTAdBgNVHQ4EFgQUE7ZQNcgl3lmryx1s5gy9mnC1rsYwHwYDVR0jBBgwFoAUE7ZQNcgl3lmryx1s5gy9mnC1rsYwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG9w0BAQsFAANBAM5wGi88jYWLgOnGbae5hH3I9lMBKxGqv17Cbm1tjWuUogVINz86lqvCpuhzLvD/vzJAqPIuDwqM8uvzjgRfZs8=\n-----END CERTIFICATE-----",
"key" : "-----BEGIN RSA PRIVATE KEY-----\nMIIBOQIBAAJBANFBGzM274DiUyqynA1MPcYxasTOwWkBTN0i7EJZg+YZM8oMi9a2vnFmozyZUwsc/T4eqpXZ2tvjqyLk3bwnKY8CAwEAAQJBAI7LMPaH/HQk/b/bVmY0qsr+me9nb9BqFLuqwzKbx0hSmWPOWFsd3rOFlSopyHqgYtAsPfvPumEdGbdnCyU8zAECIQD71768K1ejb+ei2lqZqHaczqdUNQxMh54yot9F2yVWjwIhANS1Y1Jv89WEU/ZvvMS9a4638Msv2c4GGp08RtXNYn0BAiA0H4b+cwoEbZjHf+HYg6Fo+uxu5TvSaw8287a6Qo0LyQIfVZSlYYWplT6oiX5rdLzBiap4N0gJWdsa2ihmV59LAQIgK8N+j1daq63b0bJ9k4HruhQtpgxI6U9nFBemH4zTRYM=\n-----END RSA PRIVATE KEY-----",
"timestamp" : 1650595334578,
"expire_time" : 1596865564000
}
Status Codes¶
Status Code | Description |
---|---|
200 | Request succeeded. |
400 | Request failed. |
401 | The token does not have required permissions. |
500 | Internal server error. |
Error Codes¶
See Error Codes.