Explore My Health API Documentation

These docs will explain how to use the ExploreMyHealth API to authenticate users and obtain their user data in a JSON format for your front end views.

Overview

The mobile app for ExploreMyHealth will be using users login details from the pre-existing Wordpress & ecommerce website that they have. Sending the correct credentials to the login route will return an auth key, that should be used to login to the mobile app, and an api key that is used to authenticate with the api.

Login Route (/api/login)

Users will be logging in with their Store email, and because of this you will need to send a POST request to the login route to check if the details are correct and to receive a auth key.

The Result

If the details provided are correct, the following JSON object will be returned.

Please note: Information on how to use the auth key to authenticate with wordpress can be found in this article.

                                        
{
    'email': 'apitest@imaginaire.co.uk',
}
                                        
                                    
                                        
{
    "message": "The code has been sent to your email.",
    "status": true,
    "code": 200
}
                                        
                                    

Code Verification Route (/api/verify)

Users will be logging in with their Store email and the auth code.

The Result

If the details provided are correct, the following JSON object will be returned. The auth key should be used to login to the mobile app, and the api_key is sent as a Bearer token when sending a GET request to the api to retrieve things such as patient results.

Please note: Information on how to use the auth key to authenticate with wordpress can be found in this article.

                                        
{
    'email': 'apitest@imaginaire.co.uk',
    'code': '123456'
}
                                        
                                    
                                        
{
    "data": {
        "auth_token": "token_string",
        "user_id": wordpress_user_id,
        "user_login": "wordpress_login_username",
        "api_token": "token_string",
        "api_token_type": "Bearer"
    },
    "message": "Successfully Authenticated",
    "status": true,
    "code": 200
}
                                        
                                    

GET Routes

All GET requests will need to include the api key as an Authentication header, or the request will be unauthorized.
GET Request example using axios
                                        
axios.get('https://api.imdemo.co.uk/api/user/tests', {
    headers: {
        Authorization: 'Bearer ' + api_key;
    }
});
                                        
                                    

/api/orders

Show all of the tests the authenticated user has ordered (including pending orders).

                                        
                                            {
                                                "id": 1597,
                                                "test_name": null,
                                                "test_title": null,
                                                "created_at": "2023-10-17T14:24:24.000000Z",
                                                "updated_at": "2023-10-17T14:24:24.000000Z",
                                                "patient_id": 83069010,
                                                "doctors_comments": null,
                                                "vitality_low": null,
                                                "vitality_border_low": null,
                                                "vitality_normal": null,
                                                "vitality_border_high": null,
                                                "vitality_high": null,
                                                "test_ready_status": "Pending",
                                                "doctor_id": null
                                            },
                                            {
                                                "id": 1596,
                                                "test_name": null,
                                                "test_title": null,
                                                "created_at": "2023-10-17T10:02:35.000000Z",
                                                "updated_at": "2023-10-17T10:02:35.000000Z",
                                                "patient_id": 83069010,
                                                "doctors_comments": null,
                                                "vitality_low": null,
                                                "vitality_border_low": null,
                                                "vitality_normal": null,
                                                "vitality_border_high": null,
                                                "vitality_high": null,
                                                "test_ready_status": "Pending",
                                                "doctor_id": null
                                            },
                                        
                                    

/api/user/tests

Returns data on all tests for a specific user.

                                        
[
    {
        "id": 2,
        "created_at": "2022-08-08T16:21:51.000000Z",
        "updated_at": "2022-08-09T16:03:16.000000Z",
        "patient_id": 38574298,
        "doctors_comments": "Overall everything fine in this test for api_test. No concerns."
        "doctor": {
			"id": 1,
			"name": "Dr Name",
			"email": "null@null.com",
			"avatar": "apjKVFXZgCmDM2iPDhE5AbFRvst0om9bOKTZXvsN.jpg",
			"created_at": "2022-12-21T10:40:50.000000Z",
			"updated_at": "2022-12-21T10:40:50.000000Z",
			"test_id": null
		},

    },
    {
        "id": 3,
        "created_at": "2022-08-19T11:09:12.000000Z",
        "updated_at": "2022-08-19T11:09:12.000000Z",
        "patient_id": 38574298,
        "doctors_comments": "Generated Doctors Comments for API Users Tests"
    },
    {
        "id": 4,
        "created_at": "2022-08-19T11:09:12.000000Z",
        "updated_at": "2022-08-19T11:09:12.000000Z",
        "patient_id": 38574298,
        "doctors_comments": "Generated Doctors Comments for API Users Tests"
    },
    {
        "id": 5,
        "created_at": "2022-08-19T11:09:12.000000Z",
        "updated_at": "2022-08-19T11:09:12.000000Z",
        "patient_id": 38574298,
        "doctors_comments": "Generated Doctors Comments for API Users Tests"
    },
    {
        "id": 6,
        "created_at": "2022-08-19T11:09:12.000000Z",
        "updated_at": "2022-08-19T11:09:12.000000Z",
        "patient_id": 38574298,
        "doctors_comments": "Generated Doctors Comments for API Users Tests"
    },
    {
        "id": 7,
        "created_at": "2022-08-19T11:09:12.000000Z",
        "updated_at": "2022-08-19T11:09:12.000000Z",
        "patient_id": 38574298,
        "doctors_comments": "Generated Doctors Comments for API Users Tests"
    }
]
                                        
                                    

/api/test/{test_id}

Show information for a single test.

                                        
{
    "id": 2,
    "created_at": "2022-08-08T16:21:51.000000Z",
    "updated_at": "2022-08-09T16:03:16.000000Z",
    "patient_id": 38574298,
    "doctors_comments": "Overall everything fine in this test for api_test. No concerns."
}
                                        
                                    

/api/test/{test_id}/results

Show data for the results for a test.

                                        
[
    {
        "id": 2,
        "created_at": "2022-07-20T10:08:31.000000Z",
        "updated_at": "2022-07-20T10:08:31.000000Z",
        "patient_id": 38574298,
        "result_date": "2022-07-20T00:00:00.000000Z",
        "result_status": "49\tNMOL-L\t125\t50",
        "doctors_comments": null,
        "biomarker_id": 1,
        "test_id": 2,
        "result": null,
        "biomarker": {
            "id": 1,
            "created_at": "2022-07-19T16:23:54.000000Z",
            "updated_at": "2022-07-19T16:23:54.000000Z",
            "biomarker_name": "25-OHVitaminD",
            "high_range": "500",
            "low_range": "200",
            "biomarker_description": null
        }
    },
    {
        "id": 3,
        "created_at": "2022-07-20T10:08:45.000000Z",
        "updated_at": "2022-07-20T10:08:45.000000Z",
        "patient_id": 38574298,
        "result_date": "2022-07-20T00:00:00.000000Z",
        "result_status": "49\tNMOL-L\t125\t50",
        "doctors_comments": null,
        "biomarker_id": 1,
        "test_id": 2,
        "result": null,
        "biomarker": {
            "id": 1,
            "created_at": "2022-07-19T16:23:54.000000Z",
            "updated_at": "2022-07-19T16:23:54.000000Z",
            "biomarker_name": "25-OHVitaminD",
            "high_range": "500",
            "low_range": "200",
            "biomarker_description": null
        }
    },
    {
        "id": 4,
        "created_at": "2022-07-20T10:08:45.000000Z",
        "updated_at": "2022-07-20T10:08:45.000000Z",
        "patient_id": 38574298,
        "result_date": "2022-07-20T00:00:00.000000Z",
        "result_status": "49\tNMOL-L\t125\t50",
        "doctors_comments": null,
        "biomarker_id": 3,
        "test_id": 2,
        "result": null,
        "biomarker": {
            "id": 3,
            "created_at": "2022-08-10T11:29:38.000000Z",
            "updated_at": "2022-08-10T11:29:38.000000Z",
            "biomarker_name": "Albumin",
            "high_range": null,
            "low_range": null,
            "biomarker_description": null
        }
    },
    {
        "id": 5,
        "created_at": "2022-07-20T10:08:45.000000Z",
        "updated_at": "2022-07-20T10:08:45.000000Z",
        "patient_id": 38574296,
        "result_date": "2022-07-20T00:00:00.000000Z",
        "result_status": "45\tNMOL-L\t125\t50",
        "doctors_comments": null,
        "biomarker_id": 4,
        "test_id": 2,
        "result": null,
        "biomarker": {
            "id": 4,
            "created_at": "2022-08-10T11:29:42.000000Z",
            "updated_at": "2022-08-10T11:29:42.000000Z",
            "biomarker_name": "AlkalinePhosphataseA",
            "high_range": null,
            "low_range": null,
            "biomarker_description": null
        }
    },
    {
        "id": 6,
        "created_at": "2022-08-19T11:09:12.000000Z",
        "updated_at": "2022-08-19T11:09:12.000000Z",
        "patient_id": 38574298,
        "result_date": "2022-08-19T00:00:00.000000Z",
        "result_status": "999",
        "doctors_comments": null,
        "biomarker_id": 11,
        "test_id": 2,
        "result": null,
        "biomarker": {
            "id": 11,
            "created_at": "2022-08-10T11:30:08.000000Z",
            "updated_at": "2022-08-10T11:30:08.000000Z",
            "biomarker_name": "UrineProtein",
            "high_range": null,
            "low_range": null,
            "biomarker_description": null
        }
    },
    {
        "id": 7,
        "created_at": "2022-08-19T11:09:12.000000Z",
        "updated_at": "2022-08-19T11:09:12.000000Z",
        "patient_id": 38574298,
        "result_date": "2022-08-19T00:00:00.000000Z",
        "result_status": "999",
        "doctors_comments": null,
        "biomarker_id": 21,
        "test_id": 2,
        "result": null,
        "biomarker": {
            "id": 21,
            "created_at": "2022-08-10T11:32:37.000000Z",
            "updated_at": "2022-08-10T11:32:37.000000Z",
            "biomarker_name": "Platelets",
            "high_range": null,
            "low_range": null,
            "biomarker_description": null
        }
    },
    {
        "id": 8,
        "created_at": "2022-08-19T11:09:12.000000Z",
        "updated_at": "2022-08-19T11:09:12.000000Z",
        "patient_id": 38574298,
        "result_date": "2022-08-19T00:00:00.000000Z",
        "result_status": "999",
        "doctors_comments": null,
        "biomarker_id": 24,
        "test_id": 2,
        "result": null,
        "biomarker": {
            "id": 24,
            "created_at": "2022-08-10T11:32:50.000000Z",
            "updated_at": "2022-08-10T11:32:50.000000Z",
            "biomarker_name": "TotalBilirubin",
            "high_range": null,
            "low_range": null,
            "biomarker_description": null
        }
    },
    {
        "id": 9,
        "created_at": "2022-08-19T11:09:12.000000Z",
        "updated_at": "2022-08-19T11:09:12.000000Z",
        "patient_id": 38574298,
        "result_date": "2022-08-19T00:00:00.000000Z",
        "result_status": "999",
        "doctors_comments": null,
        "biomarker_id": 2,
        "test_id": 2,
        "result": null,
        "biomarker": {
            "id": 2,
            "created_at": "2022-08-10T11:29:30.000000Z",
            "updated_at": "2022-08-10T11:29:30.000000Z",
            "biomarker_name": "Vitamin D",
            "high_range": null,
            "low_range": null,
            "biomarker_description": null
        }
    },
    {
        "id": 10,
        "created_at": "2022-08-19T11:09:12.000000Z",
        "updated_at": "2022-08-19T11:09:12.000000Z",
        "patient_id": 38574298,
        "result_date": "2022-08-19T00:00:00.000000Z",
        "result_status": "999",
        "doctors_comments": null,
        "biomarker_id": 53,
        "test_id": 2,
        "result": null,
        "biomarker": {
            "id": 53,
            "created_at": "2022-08-10T11:34:47.000000Z",
            "updated_at": "2022-08-10T11:34:47.000000Z",
            "biomarker_name": "CholesterolHDLRatio",
            "high_range": null,
            "low_range": null,
            "biomarker_description": null
        }
    }
]
                                        
                                    

/api/result/{result_id}

Show information for a single test.

                                        
[
    {
        "id": 2,
        "created_at": "2022-07-20T10:08:31.000000Z",
        "updated_at": "2022-07-20T10:08:31.000000Z",
        "patient_id": 38574298,
        "result_date": "2022-07-20T00:00:00.000000Z",
        "result_status": "49\tNMOL-L\t125\t50",
        "doctors_comments": null,
        "biomarker_id": 1,
        "test_id": 2,
        "result": null,
        "biomarker": [
            {
                "id": 1,
                "created_at": "2022-07-19T16:23:54.000000Z",
                "updated_at": "2022-07-19T16:23:54.000000Z",
                "biomarker_name": "25-OHVitaminD",
                "high_range": "500",
                "low_range": "200",
                "biomarker_description": null
            }
        ]
    }
]
                                        
                                    

/api/biomarker/{biomarker_id}

Show information for a single biomarker.

                                        
{
    "id": 1,
    "created_at": "2022-07-19T16:23:54.000000Z",
    "updated_at": "2022-07-19T16:23:54.000000Z",
    "biomarker_name": "25-OHVitaminD",
    "high_range": "500",
    "low_range": "200",
    "biomarker_description": null
}
                                        
                                    

/api/biomarkerHistory/{biomarker_id}

Show the patient's historical results for a single biomarker.

For the chart, you'll need the result_date and the result.

                                        
{
    "id": 14,
    "created_at": "2022-08-19T11:09:12.000000Z",
    "updated_at": "2022-08-19T11:09:12.000000Z",
    "patient_id": 38574298,
    "result_date": "2022-08-19T00:00:00.000000Z",
    "result_status": "Healthy",
    "biomarker_id": 40,
    "test_id": 3,
    "result": "55",
    "result_value_type": "nm"
},
{
    "id": 35,
    "created_at": "2022-08-19T11:09:12.000000Z",
    "updated_at": "2022-08-19T11:09:12.000000Z",
    "patient_id": 38574298,
    "result_date": "2022-08-19T00:00:00.000000Z",
    "result_status": "Healthy",
    "biomarker_id": 40,
    "test_id": 7,
    "result": "0.78",
    "result_value_type": "nm"
}
                                        
                                    
PUT

/api/update-user/?user_weight={$user_weight}

To update the user weight, simply send a request to the above URL containing the new weight and it will be updated for the authenticated user.

                                        
                                        {
	"user": {
		"id": 83069010,
		"name": "Seb Dean",
		"email": "emhtest@imaginaire.co.uk",
		"email_verified_at": null,
		"created_at": "2022-12-16T10:06:29.000000Z",
		"updated_at": "2023-01-10T16:16:17.000000Z",
		"is_admin": 0,
		"api_token": null,
		"vitality_low": null,
		"vitality_border_low": null,
		"vitality_normal": null,
		"vitality_border_high": null,
		"vitality_high": null,
		"gender": null,
		"date_of_birth": null,
		"height": null,
		"weight": "82",
		"avatar": null
	},
	"weight": "82"
}