#locaton_api
This is a REST API built using Django with a Postgres database. It can create Vendor records (regular) and Region records (with a GeoPolygon component).
Running the API
-
Clone the repository.
-
Create and activate a python virtualenvironment
Follow this link (https://realpython.com/blog/python/python-virtual-environments-a-primer/)
-
Install dependencies using the following command
pip install -r requirements.txt
-
Create tables using
python manage.py migrate
-
Create a superuser
python manage.py createsuperuser
-
Run the server using
python manage.py runserver
-
User
curl
or an http client like Postman to test.(Sample payloads provided in sample_json.pdf)
Usage
The following endpoints are available.
-
/vendors/
GET : List all registered vendors POST : Create a new vendor
-
/vendors/< pk >/
GET : List vendor with < pk >
PUT : Update vendor with < pk >
-
/regions/
GET : List all regions present
POST : Create a new region
-
/regions/< pk >/
GET : List region with < pk >
PUT : Update region with < pk >
-
/regions/contains/?lat=_value_&lng=_value_
GET : Return regions containing the point denoted by lat and lng values
Add ons
Includes a Heroku Procfile
for easy deployment.
Notes
You NEED a working installation of PostgreSQL and the PostGEOS add on to make sure GeoLocation queries are supported. More information about setting up a PostgreSQL GeoDjango project can be found here.
https://www.imagescape.com/blog/2011/09/21/geo-django-quickstart/
Contact
Fire an email to srvasn@gmail.com in case you have any queries.
License
This project is free to be used, provided due credits are given.