django-api-exercise

Overall :

That's a brief django-rest application, whom has two endpoints. Those endpoints provide information that was fetched through a .csv archive.

Project specifications :

Basically, this project can be segregated in the steps below:

  • Read the csv file provided by the user
  • With the values contained in the "city" column, retrieve the cordinates (latitude and longitude) trhough Google Geolocation API
  • Update the database (in this case, sqlite) with the data
  • Make an csv output file from the processed data, just to be redundant
  • Build an api with those data, with an overall endpoint, and another one, just retrieving the information of a specific 'id'
  • Make a api documentation, expliciting witch and what the existing endpoint returns

How to use?

- Open up CMD and type the path, where the code is located and press ENTER:

  • Type: python manage.py importcsv (the file with will be inserted into the database) and press ENTER:
    Note: if the 7th row data won't be "city", an error will be raised.

  • Now, you need to provide you Google API key:

  • Inform the path where the csv file is located:

  • Inform the path where the output file is located (in my case, it'll be located at the same folder):

  • Once finished the importation, you are going to see this message:

  • Done that, you're ready to run the server. Now, just type "python manage.py runserver" and press ENTER once more:

  • Go to your web browser and paste the IP adress shown at CMD and... ENTER again:

  • To get access to the entire registers storaged into the database, just go to The customer's tab

  • To get a specific piece of information about some customer, just specify its 'id' at the end:

API documentation

- The API documentation is availabe at "http://127.0.0.1:8000/doc/"