Get certificate details

get

/rest/{version}/configuration/certificates

Retrieves the imported certificate (CA signed and self signed) details. This request works only for a certificate-record, for which a certificate was already imported. The query string must include the recordName attribute and the format attribute. The value of recordName is the certificate-record to get and the format attribute is used for deciding the display format of the certificate. The order of these attributes in the query string does not matter.

Request

Path Parameters
  • REST API version string.
    Available values: v1.2
Query Parameters
  • Format of the certificate-record to be retrieved. Use either 'detail' or 'pem'.
  • Name of the certificate-record
Header Parameters
  • The value in the Authorization header must be the string "Bearer {access token}", where {access token} is a valid, unexpired token received in response to a prior /rest/{version}/auth/token request.
Back to Top

Response

200 Response

OK - Requested certificate data is returned in detail format or in PEM format in response body.

400 Response

The request is malformed in some way or is missing required information and therefore cannot be processed.

401 Response

Unauthorized - Request lacks valid authentication credentials.

404 Response

Unsupported version ID in URI or certificate specified with recordName key attribute is not found or requested format is not supported.
Back to Top

Examples

Example of Accessing the API with cURL

The following example shows how to get certificate details by submitting a GET request on the REST resource using cURL. For more information about cURL, see Use cURL.

curl -X GET \
    --header "Accept: application/xml" \
    --header "Authorization: Bearer $TOKEN" \
    "https://${SBCIP}/rest/v1.2/configuration/certificates?recordName=rest-server&format=detail"

Example of Accessing the API with Python

The following example shows how to get certificate details by submitting a GET request on the REST resource using Python. This example assumes you have a valid token stored in the token variable. For an example of authenticating with Python, see Authenticate.

import requests
headers = { "Accept":"application/xml", "Authorization":"Bearer " + token }
url  = "https://" + sbcip + "/rest/v1.2/configuration/certificates?recordName=rest-server&format=detail"
resp = requests.get(url, headers=headers)

Example of the Response Headers

The following shows an example of the response headers.

HTTP/1.1 200
Server: nginx/1.14.1
Date: Mon, 14 Sep 2020 07:50:33 GMT
Content-Type: application/xml
Transfer-Encoding: chunked
Connection: keep-alive

Example of the Response Body

The following example shows the contents of the response body in XML format.

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<response>
  <data>
    <CertificateRecordDetails>
      <certificateRecord>rest-server</certificateRecord>
      <data>
        <version>3 (0x2)</version>
        <serialNumber>11 (0xb)</serialNumber>
        <signatureAlgorithm>sha1WithRSAEncryption</signatureAlgorithm>
        <issuer>
          <country>US</country>
          <state>MA</state>
          <locality>Burlington</locality>
          <organization>Engineering</organization>
          <commonName>Acme Packet MA</commonName>
          <emailAddress>acme@example.com</emailAddress>
        </issuer>
        <validity>
          <notBefore>2020-02-13T20:00:54Z</notBefore>
          <notAfter>2025-02-12T20:00:54Z</notAfter>
        </validity>
        <subject>
          <country>US</country>
          <state>MA</state>
          <organization>Eng</organization>
          <commonName>Acme</commonName>
        </subject>
        <x509V3Extensions>X509v3 extensions:
            X509v3 Basic Constraints: 
                CA:FALSE
            X509v3 Subject Key Identifier: 
                21:9D:E1:C3:E7:CA:4A:F7:B3:47:0F:4E:FB:F1:2B:31:8F:31:D5:12
            X509v3 Authority Key Identifier: 
                keyid:D6:56:81:C0:7B:07:F5:3F:A2:18:A6:F5:70:8D:34:92:1B:73:EC:4C
                DirName:/C=US/ST=MA/L=Burlington/O=Engineering/CN=Acme Packet MA/emailAddress=acme@example.com
                serial:DA:76:D0:86:25:E5:AB:E4
            X509v3 Key Usage: 
                Digital Signature, Key Encipherment
        </x509V3Extensions>
      </data>
    </CertificateRecordDetails>
  </data>
  <messages/>
  <links/>
</response>
Back to Top