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
| Parameter | Type | Required | Description | 
|---|---|---|---|
| username | string | yes | Your username. | 
| password | string | yes | Your 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
| Parameter | Type | Required | Description | 
|---|---|---|---|
| test_id | string | yes | Alphanumeric test identifier. | 
| patient_email | string | yes | Email address of the patient. | 
| patient_name | string | yes | First name of the patient. | 
| patient_surname | string | yes | Last name of the patient. | 
| gender | string | yes | Gender of the patient (either “male” or “female”). | 
| dob | string | yes | Date of birth of the patient in “dmY” format (e.g., “01012000”). | 
| supplements | string | yes | Information about additional supplements of the patient. | 
| weight | number | no | Weight of the patient (optional). | 
| phone | string | no | Phone 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"
}