{"id":25105261,"url":"https://github.com/stanmiglight/lab4","last_synced_at":"2026-04-24T11:37:35.931Z","repository":{"id":264323780,"uuid":"893047167","full_name":"stanmiglight/Lab4","owner":"stanmiglight","description":"This project is a FastAPI task management system with two API versions (v1 and v2), each having its own database and CRUD endpoints for tasks. The API is secured using an API key stored in an .env file.","archived":false,"fork":false,"pushed_at":"2025-01-30T04:54:55.000Z","size":32,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-22T01:40:33.566Z","etag":null,"topics":["fastapi","python","python-dotenv"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stanmiglight.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-11-23T11:52:37.000Z","updated_at":"2025-01-30T04:58:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"c17891cb-e89a-45ee-8b9d-7352cfe85b60","html_url":"https://github.com/stanmiglight/Lab4","commit_stats":null,"previous_names":["stanmiglight/lab4"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/stanmiglight/Lab4","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stanmiglight%2FLab4","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stanmiglight%2FLab4/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stanmiglight%2FLab4/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stanmiglight%2FLab4/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stanmiglight","download_url":"https://codeload.github.com/stanmiglight/Lab4/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stanmiglight%2FLab4/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32222131,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-24T10:26:35.452Z","status":"ssl_error","status_checked_at":"2026-04-24T10:25:27.643Z","response_time":64,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fastapi","python","python-dotenv"],"created_at":"2025-02-07T22:52:59.749Z","updated_at":"2026-04-24T11:37:35.913Z","avatar_url":"https://github.com/stanmiglight.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Task Management API (v1 and v2)\n\nThis project is a FastAPI-based task management system that provides two versions of the API (v1 and v2). Each version has its own database and endpoints for performing CRUD (Create, Read, Update, Delete) operations on tasks. The API is secured using an API key stored in an `.env` file.\n\n## Features\n\n- **FastAPI**: A modern, fast (high-performance) web framework for building APIs with Python 3.7+ based on standard Python type hints.\n- **API Key Authentication**: Secures endpoints using an API key stored in an `.env` file.\n- **CRUD Operations**: Supports creating, reading, updating, and deleting tasks.\n- **Versioning**: Provides two versions of the API (v1 and v2) with separate databases.\n- **Error Handling**: Includes proper error handling for invalid requests, missing tasks, and unauthorized access.\n\n## Installation\n\n### Clone the repository:\n\n```bash\ngit clone https://github.com/yourusername/task-management-api.git\ncd task-management-api\n```\n\n### Set up a virtual environment (optional but recommended):\n\n```bash\npython -m venv venv\nsource venv/bin/activate  # On Windows use `venv\\Scripts\\activate`\n```\n\n### Install dependencies:\n\n```bash\npip install fastapi uvicorn python-dotenv\n```\n\n### Create a `.env` file:\n\nCreate a `.env` file in the root directory and add your API key:\n\n```env\nAPI_KEY=your_api_key_here\n```\n\n### Run the application:\n\n```bash\nuvicorn main:app --reload\n```\n\nThe `--reload` flag enables auto-reloading, so the server will restart whenever you make changes to the code.\n\n## Usage\n\nOnce the server is running, you can access the API at `http://127.0.0.1:8000`.\n\n### API Key Authentication\n\nAll endpoints require an API key for authentication. Include the API key in the `Authorization` header of your requests:\n\n```\nAuthorization: Bearer your_api_key_here\n```\n\n## Endpoints\n\n### API v1\n\n#### `GET /apiv1/`\n\n**Description**: Welcome message for API v1.\n\n**Example Request:**\n\n```bash\ncurl -X GET \"http://127.0.0.1:8000/apiv1/\" -H \"Authorization: Bearer your_api_key_here\"\n```\n\n**Example Response:**\n\n```json\n{\n  \"message\": \"Welcome to API v1\"\n}\n```\n\n#### `GET /apiv1/tasks/`\n\n**Description**: Retrieve all tasks in v1.\n\n**Example Request:**\n\n```bash\ncurl -X GET \"http://127.0.0.1:8000/apiv1/tasks/\" -H \"Authorization: Bearer your_api_key_here\"\n```\n\n**Example Response:**\n\n```json\n{\n  \"status\": \"ok\",\n  \"tasks\": [\n    {\n      \"task_id\": 1,\n      \"task_title\": \"Test 1\",\n      \"task_desc\": \"Complete FastAPI basics\",\n      \"is_finished\": false\n    }\n  ]\n}\n```\n\n#### `GET /apiv1/tasks/{task_id}`\n\n**Description**: Retrieve a specific task by `task_id` in v1.\n\n**Example Request:**\n\n```bash\ncurl -X GET \"http://127.0.0.1:8000/apiv1/tasks/1\" -H \"Authorization: Bearer your_api_key_here\"\n```\n\n**Example Response:**\n\n```json\n{\n  \"status\": \"ok\",\n  \"task\": {\n    \"task_id\": 1,\n    \"task_title\": \"Test 1\",\n    \"task_desc\": \"Complete FastAPI basics\",\n    \"is_finished\": false\n  }\n}\n```\n\n#### `POST /apiv1/tasks/`\n\n**Description**: Create a new task in v1.\n\n**Request Body:**\n\n```json\n{\n  \"task_title\": \"New Task\",\n  \"task_desc\": \"This is a new task\"\n}\n```\n\n**Example Request:**\n\n```bash\ncurl -X POST \"http://127.0.0.1:8000/apiv1/tasks/\" -H \"Authorization: Bearer your_api_key_here\" -H \"Content-Type: application/json\" -d '{\"task_title\": \"New Task\", \"task_desc\": \"This is a new task\"}'\n```\n\n**Example Response:**\n\n```json\n{\n  \"status\": \"ok\",\n  \"task\": {\n    \"task_id\": 2,\n    \"task_title\": \"New Task\",\n    \"task_desc\": \"This is a new task\",\n    \"is_finished\": false\n  }\n}\n```\n\n#### `DELETE /apiv1/tasks/{task_id}`\n\n**Description**: Delete a task by `task_id` in v1.\n\n**Example Request:**\n\n```bash\ncurl -X DELETE \"http://127.0.0.1:8000/apiv1/tasks/1\" -H \"Authorization: Bearer your_api_key_here\"\n```\n\n**Example Response:**\n\n```json\n{\n  \"status\": \"ok\",\n  \"message\": \"Task deleted successfully\"\n}\n```\n\n#### `PATCH /apiv1/tasks/{task_id}`\n\n**Description**: Update a task by `task_id` in v1.\n\n**Request Body (optional fields):**\n\n```json\n{\n  \"task_title\": \"Updated Task\",\n  \"task_desc\": \"This is an updated task\",\n  \"is_finished\": true\n}\n```\n\n**Example Request:**\n\n```bash\ncurl -X PATCH \"http://127.0.0.1:8000/apiv1/tasks/1\" -H \"Authorization: Bearer your_api_key_here\" -H \"Content-Type: application/json\" -d '{\"task_title\": \"Updated Task\", \"is_finished\": true}'\n```\n\n**Example Response:**\n\n```json\n{\n  \"status\": \"ok\",\n  \"task\": {\n    \"task_id\": 1,\n    \"task_title\": \"Updated Task\",\n    \"task_desc\": \"Complete FastAPI basics\",\n    \"is_finished\": true\n  }\n}\n```\n\n### API v2\n\nThe endpoints for API v2 (`/apiv2/`) are identical to those of API v1, but they operate on a separate database (`task_db_v2`). Refer to the v1 documentation for usage examples.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n\n## Acknowledgments\n\n- **Sir Paulo** for the idea!\n- **FastAPI** for providing an easy-to-use and high-performance web framework.\n- **python-dotenv** for managing environment variables.\n- **Python** for being awesome.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstanmiglight%2Flab4","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstanmiglight%2Flab4","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstanmiglight%2Flab4/lists"}