This endpoint is used after the successful creation of a facility via the /register_new_company.php endpoint. To upload surveys to the new Facility, you must use this endpoint because the new facility must be Active, and you must use the api_secret_key found in the response.

  1. You must check this endpoint to ensure the status of your new facility is Active, which can take up to 30 minutes for test facilities and much longer for production facilities.
  2. You must also check this endpoint to receive the api_secret_key of your new facility. You will use the api_secret_key of the new facility (and not your EHR key) to upload all surveys to it.

Connecting to the API

URL Endpoint: https://naatpdata.com/v2/api/registration_status.php

Important Variables

  • EHR_reference_facilityId varChar(254) utf_bin Case Sensitive variable is generated by your EHR.
    • It must be supplied and must exactly match (Case Sensitive!) the original EHR_reference_facilityId sent when using register_new_company.php.

javascript Postman pre-request script


const FACILITY_ID = 'ABCDEFG'; //YOUR EHR facilityId (not the id of the facility which you want to sign up)
const SECRET_KEY = 'a1b.....x9z'; //YOUR EHR secret_key (not that of the facility which you want to sign up)

const apiDate = parseInt(new Date().getTime() / 1000).toString();
const apiSignature = CryptoJS.HmacSHA256(apiDate + FACILITY_ID, SECRET_KEY).toString();

pm.environment.set("facilityId", FACILITY_ID);
pm.environment.set("apiDate", apiDate);
pm.environment.set("apiSignature", apiSignature);

Sample Postman POST :: Body = raw :: JSON


{
  "facilityId": "{{facilityId}}",
  "apiDate": {{apiDate}},
  "apiSignature": "{{apiSignature}}",
  "EHR_reference_facilityId": "ABC-ReferenceID-CreatedBy-EHR"
}

Sample Reply from API

Responses will be a JSON array and always include status and status_msg:


[
    status: 'string', // success|fail
    status_msg: 'string', // reason for failure
    EHR_reference_facilityId => 'string', // the EHR_reference_facilityId that you originally sent us
    facilityId => 'string', // ON SUCCESS ONLY, the facilityId that WE generated
    is_test_facility: 'string', // ON SUCCESS ONLY, 'y' or 'n'
    is_active => 'string', // ON SUCCESS ONLY, 'y' or 'n'.
    api_secret_key => 'string', // ON SUCCESS ONLY, and ONLY if is_active = 'y'.
]