Create Certificates
#
Create Certificates and keys#
Set the OpenHIM keyTo set the OpenHIM server key, you need to make a TLS request to the OpenHIM API for the below method and endpoint and supply a JSON object with the key.
#
ExamplesNote: In the examples below, we are using the token authentication type to authenticate requests
#
Key Example- Languages
- Sample Data
Before we can send our request to the OpenHIM API we need to ensure that we construct our valid HTTP headers to successfully authenticate with the OpenHIM API.
- NodeJS
- Bash
Copy the below code at the bottom of your nodejs script that handles the authentication of the OpenHIM headers as described in the authentication section.
Replace the openhimOptions
values with the correct implementation details and supply the SampleData
payload to submit.
Execute the below command in your terminal to run the nodejs script
Ensure that you have created your bash script to construct the HTTP authentication headers and send the request to the OpenHIM API as described in the authentication section.
Execute the below command in your terminal where the file is located with the required arguments to set the key. Replace the placeholder arguments with the correct implementation details and ensure your SampleData.json
file exists with the key object.
The response status will be 201
if successful.
#
Set up the certificateTo set the OpenHIM server certificate, you need to make a TLS request to the OpenHIM API for the below method and endpoint and supply a JSON object with the certificate.
#
Certificate Example- Languages
- Sample Data
Before we can send our request to the OpenHIM API we need to ensure that we construct our valid HTTP headers to successfully authenticate with the OpenHIM API.
- NodeJS
- Bash
Copy the below code at the bottom of your nodejs script that handles the authentication of the OpenHIM headers as described in the authentication section.
Replace the openhimOptions
values with the correct implementation details and supply the SampleData
payload to submit.
Execute the below command in your terminal to run the nodejs script
Ensure that you have created your bash script to construct the HTTP authentication headers and send the request to the OpenHIM API as described in the authentication section.
Execute the below command in your terminal where the file is located with the required arguments to set the certificate. Replace the placeholder arguments with the correct implementation details and ensure your SampleData.json
file exists with the certificate object.
The response status will be 201
if successful.
#
Add certificate to list of ca certificatesTo add a certificate to the list of ca certificates, you need to make a TLS request to the OpenHIM API for the below method and endpoint and supply a JSON object with the certificate.
#
Adding certificate Example- Languages
Before we can send our request to the OpenHIM API we need to ensure that we construct our valid HTTP headers to successfully authenticate with the OpenHIM API.
- NodeJS
- Bash
Copy the below code at the bottom of your nodejs script that handles the authentication of the OpenHIM headers as described in the authentication section.
Replace the openhimOptions
values with the correct implementation details and supply the SampleData
payload to submit. The sample data in the example for setting up of a certificate can used here. The sample data in the example for setting up of a server certificate can used here.
Execute the below command in your terminal to run the nodejs script
Ensure that you have created your bash script to construct the HTTP authentication headers and send the request to the OpenHIM API as described in the authentication section.
Execute the below command in your terminal where the file is located with the required arguments to set the certificate. Replace the placeholder arguments with the correct implementation details and ensure your SampleData.json
file exists with the certificate object.
The response status will be 201
if successful.