Stanwukong / AirBnB_clone_v3

In this version of the AirBnb Clone, we work on implementing a RESTful API using Flask for our application's backend. All work done in this repo was performed as a part of the ALX Software Engineering Certification Programme
0 stars 0 forks source link

AirBnB Clone - The RESTful API

The RESTful API is a crucial component of the AirBnB project at Holberton School. The goal of the AirBnB project is to eventually deploy our server as a simple copy of the AirBnB Website (HBnB). This segment involves creating a RESTful API to manage objects for the AirBnB (HBnB) website, which will cover fundamental concepts of web development and backend programming.

Functionalities of this RESTful API:

Table of Content

Environment

This project is interpreted/tested on Ubuntu 14.04 LTS using python3 (version 3.4.3)

Installation

File Descriptions

console.py - the console contains the entry point of the command interpreter. List of commands this console current supports:

models/ directory contains classes used for this project:

base_model.py - The BaseModel class from which future classes will be derived

Classes inherited from Base Model:

/models/engine directory contains File Storage class that handles JASON serialization and deserialization :

file_storage.py - serializes instances to a JSON file & deserializes back to instances

/tests directory contains all unit test cases for this project:

/test_models/test_base_model.py - Contains the TestBaseModel and TestBaseModelDocs classes TestBaseModelDocs class:

TestBaseModel class:

/test_models/test_amenity.py - Contains the TestAmenityDocs class:

/test_models/test_city.py - Contains the TestCityDocs class:

/test_models/test_file_storage.py - Contains the TestFileStorageDocs class:

/test_models/test_place.py - Contains the TestPlaceDoc class:

/test_models/test_review.py - Contains the TestReviewDocs class:

/test_models/state.py - Contains the TestStateDocs class:

/test_models/user.py - Contains the TestUserDocs class:

Examples of use

vagrantAirBnB_clone$./console.py
(hbnb) help

Documented commands (type help <topic>):
========================================
EOF  all  create  destroy  help  quit  show  update

(hbnb) all MyModel
** class doesn't exist **
(hbnb) create BaseModel
7da56403-cc45-4f1c-ad32-bfafeb2bb050
(hbnb) all BaseModel
[[BaseModel] (7da56403-cc45-4f1c-ad32-bfafeb2bb050) {'updated_at': datetime.datetime(2017, 9, 28, 9, 50, 46, 772167), 'id': '7da56403-cc45-4f1c-ad32-bfafeb2bb050', 'created_at': datetime.datetime(2017, 9, 28, 9, 50, 46, 772123)}]
(hbnb) show BaseModel 7da56403-cc45-4f1c-ad32-bfafeb2bb050
[BaseModel] (7da56403-cc45-4f1c-ad32-bfafeb2bb050) {'updated_at': datetime.datetime(2017, 9, 28, 9, 50, 46, 772167), 'id': '7da56403-cc45-4f1c-ad32-bfafeb2bb050', 'created_at': datetime.datetime(2017, 9, 28, 9, 50, 46, 772123)}
(hbnb) destroy BaseModel 7da56403-cc45-4f1c-ad32-bfafeb2bb050
(hbnb) show BaseModel 7da56403-cc45-4f1c-ad32-bfafeb2bb050
** no instance found **
(hbnb) quit

To run the API, use the following command:

python3 -m api.v1.app

The API will be available at http://localhost:5000/api/v1.

Examples of use

Here are some example API calls:

Bugs

No known bugs at this time.

Authors

Alexa Orrico - Github / Twitter
Jennifer Huang - Github / Twitter Femi Ajanaku - Github / Twitter Joel Iziren - [Github]()

License

Public Domain. No copy write protection.