Coder Social home page Coder Social logo

django-api's Introduction

Django API

Django CI

This repository contains code for Coursework 2 of the COMP3011 Web Services & Web Data module.

Important

Domain Name

https://sc20osc.pythonanywhere.com/

Admin Credentials

admin
{
    "username": "admin",
    "password": "admin",
}

ammar
{
    "username": "ammar",
    "password": "ammar",
}

To use the service as an admin, you may access the admin functions using https://sc20osc.pythonanywhere.com/admin/ using the provided admin credentials. This will allow you to access and modify the database. Note that this will automatically make the changes on other impacted services also.

Useful Commands

Below are some useful commands that can be used to run the service locally.

# Install dependencies
pip install -r requirements.txt

# Run migrations
python manage.py makemigrations api
python manage.py migrate

# Populate database
python manage.py populate_database

# Create admin
python manage.py create_admin

# Run server
python manage.py runserver

# Run tests
python manage.py runtests # Locally only

# Backup database
python manage.py backup_database

Database

The full database schema can be found, as generated by Swagger (see the Schemas section).

Database

API

The full API list can also be found, as generated by Redoc and by Swagger.

API

API Endpoints

To use the service with its API functionality, see generated documentation by Redoc or by Swagger for information on each endpoint including its method, request and response formats. The provided endpoints are;

Query Filters

Flights

Users can filter flights based on query parameters. For example:

  • /api/flights/?departure_airport=US-5875&destination_airport=LUCL
  • /api/flights/?airline=AA&base_price_min=100&base_price_max=300
  • /api/flights/?departure_datetime_min=2023-05-15T21:47:23Z&departure_datetime_max=2023-06-15T00:00:00Z

The filters allow users to search for flights within a range of values for various parameters such as departure datetime, arrival datetime, duration time, base price, total seats, and available seats. Users can also filter by departure airport, destination airport, and airline.

Airports

Users can filter airports based on query parameters. For example:

  • /api/airports/?city=Amboy
  • /api/airports/?country=US
  • /api/airports/?region=US-NY
  • /api/airports/?type=large_airport
  • /api/airports/?latitude_min=40&latitude_max=45
  • /api/airports/?longitude_min=-80&longitude_max=-70
  • /api/airports/?elevation_min=100&elevation_max=200
  • /api/airports/?continent=NA

Note that the filtering is case-insensitive and uses the icontains lookup expression for text-based fields, which means it will match any airport containing the specified text. You can change the lookup expression to suit your needs.

Simple Query Filters

  • Airlines (e.g. using ?code=AA)
  • Bookings (e.g. using ?booking_ref=NRZDW7I4KP&passport_number=123&flight=123)
  • Cities (e.g. using ?name=New York&country=US)
  • Countries (e.g. using ?name=US&continent=NA)

See the views.py file for more information on the filters used.

Other Diagrams

Below are some other diagrams that were created during the development of this service. They have been created using PyCharm's built-in diagramming tool.

UML

UML

Classes

Classes

Packages

Packages

django-api's People

Contributors

omariosc avatar

Stargazers

 avatar

Watchers

 avatar

Forkers

9ali-oop

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.