To create a user, you will need to make a TLS request to the OpenHIM API for the below method and endpoint and supply the JSON object for the user.
- Sample Data
- 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.
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.
openhimOptions values with the correct implementation details and supply the
SampleData payload to submit. You will also need to update the userPassword variable to your desired password. The password will be used to create the passwordHash and passwordSalt, which are added to the
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.
To create a user, you first need to generate a password hash and salt. The script below can be used for this
Copy and execute the bash script above with the below command. Substitute the <USER_PASSWORD> with your desired password before executing.
Execute the below command in your terminal where the file is located with the required arguments to create the user. Replace the placeholder arguments with the correct implementation details and ensure your
SampleData.json file exists with the user object. Add the generated passwordHash and passwordSalt to the
SampleData.json before executing the command.
The response status will be
201 if successful.
Once created, a user's activation email is sent to the users email. For this email to be sent, the OpenHIM needs to be configured with the correct mail settings. This can be done in the configuration