Make ReST API Calls with an ECA Cert

Set up Your Account to make ReST API Calls

You can make ReST API calls using your Username, ECA certificate, and an API token

Sample ReST API Calls on Linux

Info credited to our AF-DCGS users' wiki page: Making HmC API Calls using Curl

In order to make ReST API calls on Linux, you may need to convert your ECA certificate (p12 or pfx file) to a PEM file with a private key. Here are instructions for doing that using openssl:

  • openssl pkcs12 -in certfile.pfx -clcerts -nokeys -out certfile.crt
  • openssl pkcs12 -in certfile.pfx -nocerts -out certfile.key
  • openssl rsa -in certfile.key -out certfile.decrypted.key

Another example for using openssl to convert your ECA certificate PFX file to a passwordless PEM:

  • openssl pkcs12 -in certfile.pfx -out certfile.pem -nodes

Convert the passwordless pem to a new PFX file with password:

  • openssl pkcs12 -export -out certfile2.pfx -in certfile.pem

Get all the Available Deployment Runs:

curl -k --cert [PATH TO ECA CERT]:[ECA PASSWORD] --key [KEY FILE] -H token:[API TOKEN] -H "Accept: application/json"\&search_type=SEARCH_AVAILABLE

Update the content on an asset:

curl -k -X POST --cert [PATH TO ECA CERT]:[ECA PASSWORD] --key [KEY FILE] -H token:[API TOKEN] -F "filename=${fileToUpdateName}" -F "file=@${filePath}/${fileToUpdateName}"${assetToUpdate}/updatecontent

See this article for making ReST API requests using Python!

Helpful Links on Certificates and how to Convert