This repo is a build of the API endpoints for an online reporting platform
Method | Endpoint | Description | Example |
---|---|---|---|
POST |
/api/v2/reports |
Creates a new report | POST |
GET |
/api/v2/reports |
Gets all reports | payload = { |
GET |
/api/v2/reports/<reportid> |
Gets a single report by id | "flag":"", |
PUT |
/api/v1/reports/<reportid>/edit |
Edit a specific report by id | "location":"" |
DELETE |
/api/v2/reports/<reportid> |
Deletes a specific report by id | "comment":"" } |
PATCH |
api/v2/reports/status/<reportid> |
Edits the status | |
PATCH |
api/v2/reports/location/<reportid> |
Edits the location | |
PATCH |
api/v2/reports/comment/<reportid> |
Edits the comment |
To get this repo running on your local machine for development and testing purposes. Ensure that you have python 2.7
- Create a new folder in the local machine
- Open terminal and cd into the folder
cd <foldername>
- Create a virtual environment
virtualenv <nameofvirtualenv>
- Activate the virtual env
source <nameofvirtualenv>/bin/activate
To have the repo on your machine run git clone https://github.com/gkarumba/i-Reporter-endpoints.git
To install all the dependencies run pip install -r requirements.txt
To run the flask app
-
Run
export FLASK_APP=run.py
-
Run
export FLASK_ENV=development
-
Run
flask run
to start the server
To test the endpoints ensure that Postman
is installed in the local machine
Run Postman
and set the localhost to http://127.0.0.1:5000/
Add the localhost with urls for the various endpoints, for example: http://127.0.0.1:5000/api/v1/reports
then start sending the requests e.g POST
http://127.0.0.1:5000/api/v1/reports
The APIs is hosted on HEROKU and can be access via : HEROKU
run the following command on terminal : nosetests --with-coverage --cover-package=app
I use GitHub for versioning. For the versions available, there are two available versions.
- Gachegua Karumba - GitHub