{"id":28266632,"url":"https://github.com/ahmedsamir45/video-api","last_synced_at":"2026-05-02T10:41:30.080Z","repository":{"id":251290696,"uuid":"836971001","full_name":"ahmedsamir45/Video-API","owner":"ahmedsamir45","description":"restful API using flask","archived":false,"fork":false,"pushed_at":"2025-04-18T21:33:12.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-20T14:18:01.668Z","etag":null,"topics":["flask","flask-restful","restful-api","sqlalchemy"],"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/ahmedsamir45.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}},"created_at":"2024-08-02T00:14:40.000Z","updated_at":"2025-04-18T21:35:11.000Z","dependencies_parsed_at":"2024-08-02T01:49:37.188Z","dependency_job_id":null,"html_url":"https://github.com/ahmedsamir45/Video-API","commit_stats":null,"previous_names":["ahmedsamir45/rest_api_flask"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ahmedsamir45/Video-API","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmedsamir45%2FVideo-API","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmedsamir45%2FVideo-API/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmedsamir45%2FVideo-API/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmedsamir45%2FVideo-API/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ahmedsamir45","download_url":"https://codeload.github.com/ahmedsamir45/Video-API/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ahmedsamir45%2FVideo-API/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260652704,"owners_count":23042604,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["flask","flask-restful","restful-api","sqlalchemy"],"created_at":"2025-05-20T14:13:43.490Z","updated_at":"2026-05-02T10:41:30.076Z","avatar_url":"https://github.com/ahmedsamir45.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 📽️ Video API Documentation\r\n\r\n## Overview\r\n\r\nThis RESTful API allows users to **create**, **retrieve**, **update**, and **delete** video entries using Flask, Flask-RESTful, and SQLAlchemy. It uses an SQLite database to persist data.\r\n\r\n---\r\n\r\n## 🛠️ Technologies Used\r\n\r\n- **Flask**: Web framework\r\n- **Flask-RESTful**: Simplifies building REST APIs\r\n- **Flask-SQLAlchemy**: ORM for database interaction\r\n- **SQLite**: Database\r\n\r\n---\r\n\r\n## 📦 Database Model\r\n\r\n### `VideoModel`\r\n\r\n| Field | Type | Description |\r\n|-------|------|-------------|\r\n| `id` | `Integer` | Primary Key |\r\n| `name` | `String(100)` | Name of the video, required |\r\n| `views` | `Integer` | Number of views, required |\r\n| `likes` | `Integer` | Number of likes, required |\r\n\r\n---\r\n\r\n## 📥 Request Parsers\r\n\r\n### PUT (`/video/\u003cint:video_id\u003e`)\r\n\r\n| Argument | Type | Required | Description |\r\n|----------|------|----------|-------------|\r\n| `name`   | `str` | ✅ Yes | Name of the video |\r\n| `views`  | `int` | ✅ Yes | Number of views |\r\n| `likes`  | `int` | ✅ Yes | Number of likes |\r\n\r\n### PATCH (`/video/\u003cint:video_id\u003e`)\r\n\r\n| Argument | Type | Required | Description |\r\n|----------|------|----------|-------------|\r\n| `name`   | `str` | ❌ No | Updated name |\r\n| `views`  | `int` | ❌ No | Updated views |\r\n| `likes`  | `int` | ❌ No | Updated likes |\r\n\r\n---\r\n\r\n## 📤 Resource Fields (Response Format)\r\n\r\n```json\r\n{\r\n  \"id\": 1,\r\n  \"name\": \"Sample Video\",\r\n  \"views\": 100,\r\n  \"likes\": 10\r\n}\r\n```\r\n\r\n---\r\n\r\n## 🚀 Endpoints\r\n\r\n### `GET /video/\u003cint:video_id\u003e`\r\n\r\n- **Description**: Fetches a video by its ID.\r\n- **Response**:\r\n  - `200 OK` with video data\r\n  - `404 Not Found` if video ID doesn't exist\r\n\r\n---\r\n\r\n### `PUT /video/\u003cint:video_id\u003e`\r\n\r\n- **Description**: Creates a new video with the provided ID.\r\n- **Body**: JSON with `name`, `views`, and `likes`.\r\n- **Response**:\r\n  - `201 Created` with video data\r\n  - `409 Conflict` if video ID already exists\r\n\r\n---\r\n\r\n### `PATCH /video/\u003cint:video_id\u003e`\r\n\r\n- **Description**: Updates an existing video with the provided fields.\r\n- **Body**: Partial or full JSON with `name`, `views`, `likes`.\r\n- **Response**:\r\n  - `200 OK` with updated video\r\n  - `404 Not Found` if video doesn't exist\r\n\r\n---\r\n\r\n### `DELETE /video/\u003cint:video_id\u003e`\r\n\r\n- **Description**: Deletes the video with the given ID.\r\n- **Note**: This endpoint currently contains an error (see issues below).\r\n- **Response**:\r\n  - `204 No Content` if successful\r\n  - `404 Not Found` if video doesn't exist\r\n\r\n---\r\n\r\n## ⚠️ Known Issues / To Fix\r\n\r\n1. **DELETE Method Bug**:\r\n   - Uses `del videos[video_id]`, but `videos` is undefined. Should instead remove the video from the database:\r\n     ```python\r\n     result = VideoModel.query.filter_by(id=video_id).first()\r\n     if not result:\r\n         abort(404, message=\"Video doesn't exist, cannot delete\")\r\n     db.session.delete(result)\r\n     db.session.commit()\r\n     return '', 204\r\n     ```\r\n\r\n2. **String Representation Bug in `__repr__`**:\r\n   - Should reference instance variables:\r\n     ```python\r\n     def __repr__(self):\r\n         return f\"Video(name={self.name}, views={self.views}, likes={self.likes})\"\r\n     ```\r\n\r\n---\r\n\r\n## ▶️ Running the App\r\n\r\n```bash\r\npython app.py\r\n```\r\n\r\nMake sure to initialize the database first:\r\n\r\n```python\r\nfrom your_script_name import db\r\ndb.create_all()\r\n```\r\n\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahmedsamir45%2Fvideo-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fahmedsamir45%2Fvideo-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fahmedsamir45%2Fvideo-api/lists"}