doc: add cert template api usage

This commit is contained in:
Sheen Capadngan
2024-08-19 16:40:18 +08:00
parent 00039ba0e4
commit 189a610f52

View File

@@ -55,4 +55,61 @@ In the following steps, we explore how to issue a X.509 certificate using a cert
</Step>
</Steps>
</Tab>
<Tab title="API">
<Steps>
<Step title="Creating the certificate template">
To create a certificate template, make an API request to the [Create Certificate Template](/api-reference/endpoints/certificate-templates/create) API endpoint.
### Sample request
```bash Request
curl --request POST \
--url https://app.infisical.com/api/v1/pki/certificate-templates \
--header 'Content-Type: application/json' \
--data '{
"caId": "<string>",
"pkiCollectionId": "<string>",
"name": "<string>",
"commonName": "<string>",
"subjectAlternativeName": "<string>",
"ttl": "<string>"
}'
```
### Sample response
```bash Response
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"caId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"name": "<string>",
"commonName": "<string>",
"subjectAlternativeName": "<string>",
"pkiCollectionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"ttl": "<string>",
"projectId": "<string>",
"caName": "<string>"
}
```
</Step>
<Step title="Using the certificate template">
To use the certificate template, attach the certificate template ID when invoking the API endpoint for [issuing](/api-reference/endpoints/certificates/issue-certificate) or [signing](/api-reference/endpoints/certificates/sign-certificate) new certificates.
### Sample request
```bash Request
curl --request POST \
--url https://app.infisical.com/api/v1/pki/certificates/issue-certificate \
--header 'Content-Type: application/json' \
--data '{
"certificateTemplateId": "<string>",
"friendlyName": "<string>",
"commonName": "<string>",
...
}'
```
</Step>
</Steps>
</Tab>
</Tabs>