This project is a Django-based API using Django REST Framework.
-
Ensure you have Python installed on your system.
-
Install the required packages:
pip install django djangorestframework
-
Clone this repository:
git clone [repository URL] cd [project directory]
-
Run migrations:
python manage.py migrate
-
Start the development server:
python manage.py runserver
The API is now accessible at http://127.0.0.1:8000/
.
curl -X POST http://3.27.174.228/api/save_room_occupancy/ \
-H "Content-Type: application/json" \
-H "Authorization: Api-Key YOUR_API_KEY_HERE" \
-d '{
"room_name": "WZ320",
"sensor_name": "sensor1",
"presence_detected": true,
"temperature": 23.5
}'
curl -X GET http://3.27.174.228/api/check_room_occupancy/WZ320/ \
-H "Authorization: Api-Key YOUR_API_KEY_HERE"
curl -X GET http://3.27.174.228/api/get_latest_occupancy_logs/ \
-H "Authorization: Api-Key YOUR_API_KEY_HERE"
curl -X GET http://3.27.174.228/api/get_latest_room_temperature/WZ320/ \
-H "Authorization: Api-Key YOUR_API_KEY_HERE"