API Documentation

Explore NAD Medica’s API reference and templating reference.

1. Authentication

All requests to the API must be authenticated using JSON Web Tokens (JWT). To obtain a token, send a POST request to the /wp-json/jwt-auth/v1/token endpoint with your provided credentials.

Request Body Parameters

ParameterTypeRequiredDescription
usernamestringyesYour username.
passwordstringyesYour API password.

Request

POST /wp-json/jwt-auth/v1/token
Content-Type: application/json

{
  "username": "your_username",
  "password": "your_password"
}

Response

200 OK
Content-Type: application/json

{
    "token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJodHRwczovL2Jsb29kLWRldi5uYWRsYWJvcmF0b3J5LmNvbSIsImlhdCI6MTY4ODY1NjA2MCwibmJmIjoxNjg4NjU2MDYwLCJleHAiOjE2ODkyNjA4NjAsImRhdGEiOnsidXNlciI6eyJpZCI6IjgxIn19fQ.8yiVqw-gxIbx1hIplsGr316Z_scJcTJNmi_0EVl-UyY",
    "user_email": "your_email",
    "user_nicename": "your_nicename",
    "user_display_name": "you_display_name"
}

2. Register a Test

Registers a new test in the NAD Laboratory.

Request Body Parameters

ParameterTypeRequiredDescription
test_idstringyesAlphanumeric test identifier.
patient_emailstringyesEmail address of the patient.
patient_namestringyesFirst name of the patient.
patient_surnamestringyesLast name of the patient.
genderstringyesGender of the patient (either “male” or “female”).
dobstringyesDate of birth of the patient in “dmY” format (e.g., “01012000”).
supplementsstringyesInformation about additional supplements of the patient.
weightnumbernoWeight of the patient (optional).
phonestringnoPhone number of the patient (optional).

Request

POST /wp-json/api/v1/register
Content-Type: application/json
Authorization: Bearer your_token

{
  "test_id": "abc123",
  "patient_email": "[email protected]",
  "patient_name": "John",
  "patient_surname": "Doe",
  "gender": "male",
  "dob": "01012000",
  "phone": "1234567890",
  "weight": 75,
  "supplements": "Optional supplements information"
}

Response

200 OK
Content-Type: application/json

{
    "Status": true,
    "StatusCode": 1000,
    "StatusMessage": "success",
    "Data": [
        "your_test_id"
    ]
}

3. Error Handling

If there are any errors with the request, you will receive an appropriate error response.

Example Error Response

200 OK
Content-Type: application/json

{
    "Status": false,
    "StatusCode": 0,
    "StatusMessage": "Incorrect Data"
}