Skip to content

CA Search Certificates REST API

Endi S. Dewata edited this page Oct 2, 2024 · 10 revisions

API v2

Request

  • Path: /ca/v2/certs/search

  • Method: POST

  • Query Parameters:

    • start: integer

    • size: integer

Response

  • entries

API v1

Request

  • Path: /ca/rest/certs/search

  • Method: POST

  • Query Parameters:

    • start: integer

    • size: integer

Response

  • total

  • entries

Examples

API v1 with JSON
$ curl \
    -k \
    -s \
    -X POST \
    -d @- \
    -H "Content-Type: application/json" \
    -H "Accept: application/json" \
    https://localhost.localdomain:8443/ca/rest/certs/search << EOF | python -m json.tool
{
    "subjectInUse": true,
    "commonName": "Certificate Authority"
}
EOF
{
    "total": 1,
    "entries": [
        {
            "id": "0x1",
            "SubjectDN": "CN=Certificate Authority,O=EXAMPLE",
            "IssuerDN": "CN=Certificate Authority,O=EXAMPLE",
            "Status": "VALID",
            "Type": "X.509",
            "Version": 2,
            "KeyAlgorithmOID": "1.2.840.113549.1.1.1",
            "KeyLength": 2048,
            "NotValidBefore": 1629326630000,
            "NotValidAfter": 2260478630000,
            "IssuedOn": 1629326630000,
            "IssuedBy": "system",
            "Link": {
                "rel": "self",
                "href": "https://localhost.localdomain:8443/ca/rest/certs/0x1"
            }
        }
    ],
    "Link": []
}
API v2 with XML
$ curl \
    -k \
    -s \
    -X POST \
    -d @- \
    -H "Content-Type: application/xml" \
    https://localhost.localdomain:8443/ca/rest/certs/search << EOF | xmllint --format -
<CertSearchRequest>
  <subjectInUse>true</subjectInUse>
  <commonName>Certificate Authority</commonName>
</CertSearchRequest>
EOF
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<CertDataInfos>
  <total>1</total>
  <CertDataInfo id="0x1">
    <SubjectDN>CN=Certificate Authority,O=EXAMPLE</SubjectDN>
    <IssuerDN>CN=Certificate Authority,O=EXAMPLE</IssuerDN>
    <Status>VALID</Status>
    <Type>X.509</Type>
    <Version>2</Version>
    <KeyAlgorithmOID>1.2.840.113549.1.1.1</KeyAlgorithmOID>
    <KeyLength>2048</KeyLength>
    <NotValidBefore>1629326630000</NotValidBefore>
    <NotValidAfter>2260478630000</NotValidAfter>
    <IssuedOn>1629326630000</IssuedOn>
    <IssuedBy>system</IssuedBy>
    <Link href="https://localhost.localdomain:8443/ca/rest/certs/0x1" rel="self"/>
  </CertDataInfo>
</CertDataInfos>

Sources

Clone this wiki locally