-
Notifications
You must be signed in to change notification settings - Fork 5
API Documentation
Aditya Shibu edited this page Feb 15, 2025
·
4 revisions
- Navigate to the root route to check if FastAPI has been setup correctly
- Response:
{
"message": "Welcome to the Smart Home API!"
}- Navigate to
/device_infoto retrieve the JSON of all simulated smart home devices. - The response includes details like device ID, name, status, connection status, IP address, and other relevant properties.
- Sending a
POSTrequest to this API randomly changes the specified status of a device. - The function
changeDeviceStatusindevices_json.pyhandles this behavior. - Request:
POST /device/{id}/status- Response Example:
{
"success": "Changed Status to on."
}- Sending a
POSTrequest to this API changes the name of a device. - The function
changeDeviceNameindevices_json.pyhandles this behavior. - Request:
POST /device/{id}/name/{new_name}- Response Example:
{
"success": "Changed device name to new_name."
}- Navigate to
/updatesto retrieve the list of updates. - The function
getUpdatesindevices_json.pyhandles this behavior. - Response Example:
{
"updates": ["Update 1", "Update 2"]
}- Sending a
POSTrequest to this API toggles the connection status of a device. - The function
changeConnectionindevices_json.pyhandles this behavior. - Request:
POST /device/{id}/connect- Response Example:
{
"success": "Connected device_name."
}This documentation is maintained by Aditya S. For any queries or issues, please contact as2397@hw.ac.uk.