Welcome to the Quotes API project! This API allows you to manage and retrieve quotes, authors, and categories for inspirational and motivational content.
Before you begin, ensure you have met the following requirements:
- Python3
- virtualenv
Clone this repository:
git clone https://github.com/MehakKambo/quotes-api.git
cd quotes-api
Create and Activate virtual environment:
python3 -m venv env
source env/bin/activate
Install all the dependencies:
pip install -r requirements.txt
Running the API
Flask run
Your Flask server will begin running and can be accessed at http://127.0.0.1:5000
-
Retrieve Random Quote
- Endpoint:
/quotes/random
- Method: GET
- Description: Returns a randomly selected quote from the database.
- Endpoint:
-
Retrieve Quote by ID
- Endpoint:
/quotes/{id}
- Method: GET
- Description: Retrieves a specific quote by its unique identifier (ID).
- Endpoint:
-
List All Authors
- Endpoint:
/authors
- Method: GET
- Description: Retrieves a list of all authors from the database.
- Endpoint:
-
List Quotes by Author Name
- Endpoint:
/quotes/author/{authorName}
- Method: GET
- Description: Retrieves a list of quotes by a specific author using its name.
- Endpoint:
-
List Quotes by Author ID
- Endpoint:
/quotes/author/{authorID}
- Method: GET
- Description: Retrieves a list of quotes by a specific author using its ID.
- Endpoint:
-
List Quotes by Category Name
- Endpoint:
/quotes/category/{categoryName}
- Method: GET
- Description: Retrieves a list of quotes belonging to a specific category using its name.
- Endpoint:
-
List Quotes by Category ID
- Endpoint:
/quotes/category/{categoryID}
- Method: GET
- Description: Retrieves a list of quotes belonging to a specific category using its ID.
- Endpoint:
-
List All Categories
- Endpoint:
/categories
- Method: GET
- Description: Retrieves a list of all categories for quotes.
- Endpoint:
-
Add a New Quote
- Endpoint:
/quotes
- Method: POST
- Required URL Parameters:
["quote", "author", "category"]
- Description: Allows users to submit new quotes to be added to the database.
- Endpoint:
-
Update Quote
- Endpoint:
/quotes/{id}
- Method: PATCH
- URL Parameters (At least one should be present):
["quote", "author", "category"]
- Description: Allows users to update an existing quote by providing new text, author, or category.
- Endpoint:
\i /path/to/the/schema.sql
Contributions are welcome! Please follow these guidelines:
- Fork the repository.
- Create your feature branch:
git checkout -b feature-name
- Commit Your changes:
git commit -m 'Add some feature'
- Push to the branch:
git push origin feature-name
- Submit a pull request.
This project is licensed under the BSD-3-Clause license.