{"id":20461281,"url":"https://github.com/infectedduck/eventsnap-manager-api","last_synced_at":"2025-03-05T11:28:39.062Z","repository":{"id":256875343,"uuid":"850558105","full_name":"InfectedDuck/EventSnap-Manager-API","owner":"InfectedDuck","description":"A Flask-based API to manage pictures stored in a JSON file. Supports creating, retrieving, updating, and deleting pictures with event details. Includes test cases for each endpoint to ensure functionality.","archived":false,"fork":false,"pushed_at":"2024-09-14T00:06:49.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-16T00:37:31.372Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/InfectedDuck.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-09-01T05:52:21.000Z","updated_at":"2024-09-14T00:06:52.000Z","dependencies_parsed_at":"2024-09-13T15:21:45.029Z","dependency_job_id":"b47d242d-e868-4390-bfab-0c34d3151d2c","html_url":"https://github.com/InfectedDuck/EventSnap-Manager-API","commit_stats":null,"previous_names":["infectedduck/back-end-development-pictures"],"tags_count":0,"template":false,"template_full_name":"ibm-developer-skills-network/luggb-Back-End-Development-Pictures","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InfectedDuck%2FEventSnap-Manager-API","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InfectedDuck%2FEventSnap-Manager-API/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InfectedDuck%2FEventSnap-Manager-API/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InfectedDuck%2FEventSnap-Manager-API/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/InfectedDuck","download_url":"https://codeload.github.com/InfectedDuck/EventSnap-Manager-API/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242017715,"owners_count":20058487,"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":[],"created_at":"2024-11-15T12:24:38.535Z","updated_at":"2025-03-05T11:28:39.037Z","avatar_url":"https://github.com/InfectedDuck.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Picture Management API\n\nThis project provides a **Flask-based API** for managing a collection of pictures stored in a JSON file. The API supports operations for creating, retrieving, updating, and deleting pictures, and comes with test cases for validating each endpoint. The application uses `Flask` and stores the picture metadata, such as event details and picture URLs, in a `pictures.json` file.\n\n## Features\n\n- **Health Check**: Simple endpoint to verify the health of the API.\n- **Picture Management**:\n  - **Create** a new picture.\n  - **Retrieve** all pictures or a specific picture by ID.\n  - **Update** an existing picture by ID.\n  - **Delete** a picture by ID.\n- **Data Storage**: All picture data is stored in the `pictures.json` file and can be updated via the API.\n  \n## Data Structure\n\nThe picture data is stored as JSON and includes the following fields:\n\n- `id`: Unique identifier for the picture.\n- `pic_url`: URL of the picture.\n- `event_country`: Country where the event occurred.\n- `event_state`: State where the event occurred.\n- `event_city`: City where the event occurred.\n- `event_date`: Date of the event in `MM/DD/YYYY` format.\n\n### Example JSON Entry:\n\n```json\n{\n    \"id\": 2,\n    \"pic_url\": \"http://dummyimage.com/230x100.png/dddddd/000000\",\n    \"event_country\": \"United States\",\n    \"event_state\": \"*Florida\",\n    \"event_city\": \"Naples\",\n    \"event_date\": \"11/2/2022\"\n}\n```\n\n## API Endpoints\n\n### Health Check\n\n**GET /health**\n\nChecks the health of the application.\n\n#### Response:\n```json\n{\n  \"status\": \"OK\"\n}\n```\n\n## Count Pictures\n\n**GET /count**\n\nReturns the total number of pictures.\n\n#### Response:\n```json\n{\n  \"length\": 10\n}\n```\n## Get All Pictures\n\n**GET /picture**\n\nRetrieves the full list of pictures.\n\n#### Response:\n```json\n[\n  {\n    \"id\": 2,\n    \"pic_url\": \"http://dummyimage.com/230x100.png/dddddd/000000\",\n    \"event_country\": \"United States\",\n    \"event_state\": \"*Florida\",\n    \"event_city\": \"Naples\",\n    \"event_date\": \"11/2/2022\"\n  },\n  ...\n]\n```\n\n## Get Picture by ID\n\n**GET /picture/\u003cint:id\u003e**\n\nRetrieves a specific picture by its ID.\n\n#### Response:\n```json\n{\n  \"id\": 2,\n  \"pic_url\": \"http://dummyimage.com/230x100.png/dddddd/000000\",\n  \"event_country\": \"United States\",\n  \"event_state\": \"*Florida\",\n  \"event_city\": \"Naples\",\n  \"event_date\": \"11/2/2022\"\n}\n```\n\n\n## Create a Picture\n\n**POST /picture**\n\nAdds a new picture to the collection.\n\n### Request Body:\n```json\n{\n  \"id\": 11,\n  \"pic_url\": \"http://dummyimage.com/123x100.png/5fa2dd/ffffff\",\n  \"event_country\": \"United States\",\n  \"event_state\": \"California\",\n  \"event_city\": \"Fremont\",\n  \"event_date\": \"11/2/2030\"\n}\n```\n\n### Response: 201 Created\n```json\n{\n  \"id\": 11,\n  \"pic_url\": \"http://dummyimage.com/123x100.png/5fa2dd/ffffff\",\n  \"event_country\": \"United States\",\n  \"event_state\": \"California\",\n  \"event_city\": \"Fremont\",\n  \"event_date\": \"11/2/2030\"\n}\n```\n### If the picture with the same ID already exists:\n### Response: 302 Found\n\n```json\n{\n  \"Message\": \"picture with id 11 already present\"\n}\n```\n\n\n\n## Update a Picture\n\n**PUT /picture/\u003cint:id\u003e**\n\nUpdates an existing picture by its ID.\n\n### Request Body:\n```json\n{\n  \"id\": 2,\n  \"pic_url\": \"http://dummyimage.com/230x100.png/dddddd/000000\",\n  \"event_country\": \"United States\",\n  \"event_state\": \"*Florida\",\n  \"event_city\": \"Naples\",\n  \"event_date\": \"11/2/2022\"\n}\n```\n\n### Response: 200 OK\n```json\n{\n  \"id\": 2,\n  \"pic_url\": \"http://dummyimage.com/230x100.png/dddddd/000000\",\n  \"event_country\": \"United States\",\n  \"event_state\": \"*Florida\",\n  \"event_city\": \"Naples\",\n  \"event_date\": \"11/2/2022\"\n}\n```\n\n## Delete a Picture\n\n**DELETE /picture/\u003cint:id\u003e**\n\nDeletes a picture by its ID.\n\n### Response: `204 No Content`\n\n### If the picture doesn't exist:\n\n**Response: `404 Not Found`**\n```json\n{\n  \"message\": \"Picture not found\"\n}\n```\n\n## Running Tests\n\nYou can run the tests using `pytest`. The test suite ensures that the endpoints are working as expected and the data is correctly handled.\n\n```bash\npytest\n```\n\n\n## License\nThis project is licensed under the Apache License 2.0. See the [LICENSE](LICENSE) file for details. \u003cbr\u003e\nThis project is made as a part of IBM Course.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfectedduck%2Feventsnap-manager-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finfectedduck%2Feventsnap-manager-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfectedduck%2Feventsnap-manager-api/lists"}