Skip to content

This API allows you to: Registering a drone, loading a drone with medicine, get loaded medicine for a given drone, get available drones , get drone battery level.

Notifications You must be signed in to change notification settings

charlesncn/Drone-Management-API

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 

Repository files navigation

Drone Controller API

Service to manage drones

REST API

Language

Python

framework

Flask

Database

Mongodb (running locally)

API test platform

postman

prerequisites & required installations

Python3
Mongodb
Postman

About the project.

This API allows the client to.

  • registering a drone.
  • loading a drone with medication items.
  • checking loaded medication items for a given drone.
  • checking available drones for loading.
  • check drone battery level for a given drone.


This service uses random a python library to generate Data for various variables used in the project. It also assigns different states to newly created drone and also assigning battery charge value. This data is then consumed by the API in JSON form and fed to the database. Using Postman, the required data can be fetched/updated using the same data format(JSON)


Build instructions

IDE used VSCODE

  • To run MongoDb open terminal and type mongo start
  • Open folder containing the file task_Drone.py on yout IDE(I used VSCODE)
  • Open terminal on VsCode by pressing Ctrl+ . (help in displaying vital information when the program is running)
  • Click Run button.

Testing

open Postman and type the following commands to test the API.

1. registering a drone

Select POST method then type http://localhost:5000/add on the URL bar, Click SEND to send the request. You shoud be ble to see a success message.



2. loading a drone with medication items;

Select PUT method then type http://localhost:5000/add-load on the Url bar, Click SEND to execute the request. Every time a drone is loaded its state changes from IDLE to LOADING.

fig 2.0 Loading a drone with a state IDLE with medication.


fig 2.1 Loading drone that is not at IDLE state


3. checking loaded medication items for a given drone;

Select GET method and type http://localhost:5000/get-med/<id> on the url bar. Replace with the actual id of the drone you want to check. and click SEND The API will filter out the fields containing information about medication loaded to that drone.




4. checking available drones for loading;

This method filters out those drones that are IDLE and have Charge of more than 25%. Select GET method and type http://localhost:5000/available on the url bar and click SEND. In this case there was only one drone that was IDLE

However after adding more drones to the fleet I got another IDLE drone with a healthy battery.




5. check drone battery level for a given drone.

Select GET method and type hhttp://localhost:5000/get-battery/<id> on the url bar. Replace with the actual id of the drone you want to check. and click SEND.




Battery Log.




END

About

This API allows you to: Registering a drone, loading a drone with medicine, get loaded medicine for a given drone, get available drones , get drone battery level.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages