Version: 7.0.x

Read Server Uptime

To read the OpenHIM uptime you will need to make a TLS request to the OpenHIM API for the below method and endpoint.

Method: GET
Endpoint: {openhim_url}:8080/heartbeat


Copy the below code into a file titled openhim-api.js

(async () => {
const openhimOptions = {
apiURL: 'https://localhost:8080',
apiEndpoint: '/heartbeat',
rejectUnauthorized: false
const options = { method: 'GET',
url: `${openhimOptions.apiURL}${openhimOptions.apiEndpoint}`,
rejectUnauthorized: openhimOptions.rejectUnauthorized
request(options, (error, response, body) => {
if (error) throw new Error(error)
statusCode: response.statusCode,

Execute the below command in your terminal to run the nodejs script

node openhim-api.js

The response status code will be 200 if successful.