Getting Started

This section helps you to get started with Certificate Management API. An example to get server certificates using cURL and Python is shown below.

Base URI

Every API request will begin with the following Base URI.

/platformcom/api/v1/certmgr/config

Get server certificates using cURL

cURL is an open source, cross-platform tool able to perform URL-based network requests from the command line: https://curl.haxx.se/

cURL can be used, among other things, to make HTTP requests, including REST requests. In this example, we will demonstrate how all the server certificates can be fetched using one of the certificate management APIs. We will use the following API to achieve this:

/platformcom/api/v1/certmgr/config/snapshot/server

The cURL command can be executed as follows:

curl -k -X 'GET' -u "username:password" -H 'Content-Type: application/json' https://<server>/platformcom/api/v1/certmgr/config/snapshot/server

Note: Be sure to replace username, password and server with values from your deployment.

The parameters given are as follows:

-k : Disable HTTPS server certificate authentication. It is highly recommended that you do not do this.

-u : The HTTP Basic Auth username and password, i.e. the platform user credentials.

-H : HTTP Header. In this case to specify json

-X : HTTP method. In this case GET

Get server certificates using Python

To make a secure request to the Certificate Management API, the SSL/TLS certificate store for your programming environment must contain the tomcat-ECDSA certficate obtained from the UC server. See the Security Guide for more details on downloading certificates.

The following samples assumes the tomcat-ECDSA cert is in the local directory:

import requests

def getCertificates (hostname, username, password):
    response = requests.get(
                            url = ''.join(('https://', hostname, '/platformcom/api/v1/certmgr/config/snapshot/server')),
                            headers = {'Content-Type': 'application/json'}, 
                            auth = (username, password), 
                            verify = 'cucm-tomcat-ECDSA-cert.pem'
                           )
    print('Server response: ' +response.text)

if __name__ == "__main__":
    getCertificates(hostname, username, password)