It is a bmi API, build purely using Python (programming language), Django and Django-Rest-Framework (opensource framework written in python).
Listing the features of the API
- Given
weight
andheight
, calculatesbmi index
,bmi category
andhealth risk
- Gives the stats of count of each category of
bmi category
andhealth risk
API Endpoints defines the structure of the API and how end users access data from our application using the HTTP methods - POST
Endpoint | HTTP Method | CURD Method | Result |
---|---|---|---|
api/v1/bmi |
POST | CREATE | Create 3 new key-value pair bmi index , bmi catg and health risk |
api/v1/bmi/stats |
POST | CREATE | Gives back common stats of the data |
- API View Ends Path : core.bmi.views
- BMI Business Logic Path : core.bmi.utils
- API Tests Path : core.bmi.tests
python manage.py test bmi.tests.view.BMITests
- 2 Tests Passed
- BMI Details
-
POST
http://localhost:8000/api/v1/bmi/
- Body
[{"Gender": "Male", "HeightCm": 171, "WeightKg": 96 }, { "Gender": "Male", "HeightCm": 161, "WeightKg":85 }]
- Response
[ { "Gender": "Male", "HeightCm": 171, "WeightKg": 96, "bmi": 56.14, "bmi_catg": "Very Severely Obese", "health_risk": "Very High Risk" }, { "Gender": "Male", "HeightCm": 161, "WeightKg": 85, "bmi": 52.8, "bmi_catg": "Very Severely Obese", "health_risk": "Very High Risk" } ]
- Body
-
POST
http://localhost:8000/api/v1/bmi/stats
- Body
[{"Gender": "Male", "HeightCm": 171, "WeightKg": 96 }, { "Gender": "Male", "HeightCm": 161, "WeightKg":85 }]
- Response
{ "Very Severely Obese": 2, "Very High Risk": 2 }
- Body
-