Coder Social home page Coder Social logo

car_api's Introduction

Basic Django Rest API

Check basic car makes and models existence in database.

Add, rate, delete and view most rated cars.

API is interacting with an external API https://vpic.nhtsa.dot.gov/api/ for car existence validation.

Available online: http://car-django-api.herokuapp.com/cars/

Endpoints:

(more detailed description to the endpoints with described data structure for POST/DELETE requests can be found in 'endpoints.txt')

GET /cars/

POST /cars/

DELETE /cars/{ id }/

POST /rate/

GET /popular/

You can interact with the API only programmatically. This means you have to use tools like POSTMAN, or send requests programmatically to the relative endpoints.

Interracting with API does not require authentication.

Run project on local machine - project is dockerized with use of docer-compose.

To run project on Docker on local machine:

  1. Clone project to local machine
  2. Create a file '.env' in a project root directory and set your environment variables. You can find an example of a file 'env.template'.
  3. Run in a terminal:
docker-compose up

Open your browser to http://localhost:8000/cars/ and you should see the browsable version of the API.

Testing and logging issues:

All provided requirements are covered with testing.

You can run tests: py manage.py tests

Logging issues:

Any issues when interracting with API are printed out in the terminal.

Development

If you do not use Docker, you can also run project after some basic project setup.

Setup

Create and activate a virtual environment (Python3) using your preferred method. This functionality is built into Python, if you do not have a preference.

From the command line, type:

git clone https://github.com/klimuntowskirafal/car_api
pip install -r requirements.txt
python manage.py migrate
python manage.py loaddata test_car_data.json  #load dummy-data
python manage.py runserver --settings car_api.settings_local

Open your browser to http://localhost:8000/cars/ and you should see the browsable version of the API.

car_api's People

Contributors

klimuntowskirafal avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.