/task_api

8 requests methods in fastapi

Primary LanguagePython

Task API

Ever Alvarez 9A Software Engineering BIS


Task API is a FastAPI-based application for managing tasks. It allows users to perform CRUD (Create, Read, Update, Delete) operations on tasks. This API is protected by Firebase Authentication and provides endpoints for user registration, login, task creation, updating, deletion, and more.

Table of Contents

Overview

This FastAPI application is designed for managing tasks with the following features:

  • User registration and login using Firebase Authentication.
  • Create, read, update, and delete tasks.
  • Secure access to tasks based on user authentication.
  • Swagger documentation and ReDoc for API reference.

Dependencies

The following libraries and services are used in this project:

Getting Started

  1. Clone this repository to your local machine.
  2. Create a Firebase project and configure your credentials.
  3. Set the required environment variables in a .env file.
  4. Install the project dependencies using pip install -r requirements.txt.
  5. Run the FastAPI application with uvicorn main:app --reload.

Make sure to replace FIREBASE_CREDENTIALS and other necessary environment variables with your Firebase project configuration.

API Endpoints

The API provides the following endpoints:

  • POST /register: User registration.
  • POST /login: User login.
  • GET /tasks: Retrieve user-specific tasks.
  • POST /task: Create a new task.
  • PUT /task/{task_id}: Update a task.
  • DELETE /task/{task_id}: Delete a task.
  • PATCH /task/{task_id}/complete: Mark a task as completed.

For detailed request and response examples, refer to the Swagger Documentation, ReDoc, or the API endpoints section of the code.

Authentication

User registration and login are required to access protected API endpoints. Firebase Authentication is used to securely manage user authentication. To register a new user, use the /register endpoint, and for login, use the /login endpoint. You will receive an access token for making authenticated requests to other endpoints.

Options, Head, and Trace Requests

The API also supports OPTIONS, HEAD, and TRACE requests:

  • OPTIONS /options: List supported HTTP methods.
  • HEAD /head: Retrieve headers.
  • TRACE /trace: Trace HTTP request details.

These endpoints are primarily used for testing and exploring the available HTTP methods.

Note: Web browsers do not support TRACE requests. You can test this endpoint using cURL:

curl -v -X TRACE https://tasks-api-8-methods-bbf271afd2c6.herokuapp.com/trace