CertStore AddCert
CertStore AddCert
The POST AddCert method will schedule the addition of the provided certificate to the specified alias/name within the provided certificate stores. The request and response objects will contain the fields shown in Table 696: POST /AddCert Request Body and Table 697: POST /AddCert Response Body.
Table 696: POST /AddCert Request Body
|
Parameter Name |
Parameter Value |
|---|---|
|
Keystores |
Array of the certificate stores to which the provided entry should be added, with the same format as the response to GET /Keystores (see Table 711: GET /Keystores Response Body). |
|
Alias |
Name of the entry to which the certificate should be added. This parameter can also take a list of Certificate Store Type and Alias entries. If just a name is given, the certificate will have the same alias in all certificate stores it is added to. If a list is given, the certificate will have the same alias for each given store with the same certificate store type. |
|
Overwrite |
Boolean denoting if the entry should be overwritten, if one exists. An error will be returned if this is set to false, and an entry with the same alias/name exists. |
|
Contents |
PEM of the certificate to be added. This field is optional if a CertificateId is provided. |
|
CertificateId |
Database identifier within Keyfactor Command of the certificate to be added. This field is optional if the Contents are provided. |
Table 697: POST /AddCert Response Body
|
Parameter Name |
Parameter Value |
|||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Result |
Numerical code indicating the result of the operation, as described in Table 701: POST /AddCertStoreServer Response Body. |
|||||||||||||||||||||||||||||
|
Message |
Description of the result of the operation, e.g. "The operation completed successfully". |
|||||||||||||||||||||||||||||
|
InvalidKeystores |
Array of certstores provided in the request for which the operation could not be completed. Entries will be formatted as follows:
|
|||||||||||||||||||||||||||||
Example Request
Multiple Alias entries
POST http://<host>/CMSApi/CertStore/1/AddCert HTTP/1.1
{
"Keystores":
[
{"Id": "", "ClientMachine": "<client-machine>", "StorePath": "<store-path>"},
{"Id": "", "ClientMachine": "<client-machine>", "StorePath": "<store-path>"}
],
"Alias": {"<store type Id>":"<alias>","<store type Id":"alias"}
"Overwrite": true,
"CertificateId": "<certificate-id>",
"Contents": "-----BEGIN CERTIFICATE-----
<base64-encoded-certificate-contents>
-----END CERTIFICATE-----"
}
Example Request
String Alias
POST http://<host>/CMSApi/CertStore/1/AddCert HTTP/1.1
{
"Keystores":
[
{"Id": "", "ClientMachine": "<client-machine>", "StorePath": "<store-path>"},
{"Id": "", "ClientMachine": "<client-machine>", "StorePath": "<store-path>"}
],
"Alias": "<alias>",
"Overwrite":true,
"CertificateId":"<certificate-id>",
"Contents": "-----BEGIN CERTIFICATE-----
<base64-encoded-certificate-contents>
-----END CERTIFICATE-----"
}
Example Response
{
"Result": 1,
"Message" : "The operation completed successfully.",
"InvalidKeystores": []
}