{"id":24468738,"url":"https://github.com/brianobot/zuri_internship_task_2","last_synced_at":"2025-03-14T13:23:31.031Z","repository":{"id":193886204,"uuid":"689678092","full_name":"brianobot/zuri_internship_task_2","owner":"brianobot","description":"Task 2 Repo","archived":false,"fork":false,"pushed_at":"2023-09-12T14:20:38.000Z","size":90,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-21T07:12:57.409Z","etag":null,"topics":["api-service","brian-obot","internship","internship-challenge","internship-project","internship-task","zuri-internship-programme"],"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/brianobot.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}},"created_at":"2023-09-10T15:14:01.000Z","updated_at":"2023-09-11T21:03:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"bc7b4721-1289-4de2-afca-139dcee20533","html_url":"https://github.com/brianobot/zuri_internship_task_2","commit_stats":null,"previous_names":["brianobot/zuri_internship_task_2"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianobot%2Fzuri_internship_task_2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianobot%2Fzuri_internship_task_2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianobot%2Fzuri_internship_task_2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brianobot%2Fzuri_internship_task_2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brianobot","download_url":"https://codeload.github.com/brianobot/zuri_internship_task_2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243581617,"owners_count":20314274,"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":["api-service","brian-obot","internship","internship-challenge","internship-project","internship-task","zuri-internship-programme"],"created_at":"2025-01-21T07:13:04.412Z","updated_at":"2025-03-14T13:23:31.001Z","avatar_url":"https://github.com/brianobot.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# zuri_internship_task_2\n\nTask 2 Repo\n\n[![Build Status](https://img.shields.io/badge/Build-Passing-brightgreen.svg)](https://github.com/brianobot/zuri_internship_task_2)\n[![Tests Passed](https://img.shields.io/badge/Tests-Passed-brightgreen.svg)](https://your-test-results-url)\n[![Code Style: Black](https://img.shields.io/badge/Code%20Style-Black-000000.svg)](https://github.com/psf/black)\n\n\n## 🌐 BASE URL: https://brianobot.pythonanywhere.com/\n\n# Person Webservice Documentation\n\n## Introduction\n\nThe **Person Webservice** is a RESTful API that allows users to interact with a `Person` resource. This webservice provides basic CRUD (Create, Read, Update, Delete) operations for managing `Person` objects.\n\n### UML Diagram\n\n![Person Model UML Diagram](uml_diagrams/person_model.png)\n\n### Resource: Person\n\nA `Person` object represents an individual with a name.\n\n#### Fields\n\n- `name` (String, max length 100): The unique identifier of the person. It is a required field and must be a string.\n\n## API Endpoints\n\n### 1. Create a Person\n\n**Endpoint:** `POST /api/`\n\n**Request:**\n```json\n{\n    \"name\": \"Mark Essien\"\n}\n```\n\n**Response:**\n```json\n{\n    \"id\": 1,\n    \"name\": \"Mark Essien\"\n}\n```\n\n### 2. Retrieve a Person\n\n**Endpoint:** `GET /api/{user_id}/`\n\n**Response:**\n```json\n{\n    \"id\": 1,\n    \"name\": \"Mark Essien\"\n}\n```\n\n### 3. Update a Person\n\n**Endpoint:** `PUT /api/{user_id}/`\n\n**Request:**\n```json\n{\n    \"name\": \"Mark Essien Updated\"\n}\n```\n\n**Response:**\n```json\n{\n    \"id\": 1,\n    \"name\": \"Mark Essien Updated\"\n}\n```\n\n### 4. Delete a Person\n\n**Endpoint:** `DELETE /api/{user_id}/`\n\n**Response:**\n```json\n{\n    \"message\": \"Person with id 1 has been deleted\"\n}\n```\n\n\n## Example Usage\n\n```python\n# Creating a new person\nimport requests\n\nurl = \"https://brianobot.pythonanywhere.com/api\"\npayload = {\n    \"name\": \"Mark Essien\"\n}\nresponse = requests.post(url, json=payload)\nprint(response.json())\n\n# Retrieving a person\nuser_id = 1\nurl = f\"https://brianobot.pythonanywhere.com/api/{user_id}/\"\nresponse = requests.get(url)\nprint(response.json())\n\n# Updating a person\nuser_id = 1\nurl = f\"https://brianobot.pythonanywhere.com/api/{user_id}/\"\npayload = {\n    \"name\": \"Mark Essien Updated\"\n}\nresponse = requests.put(url, json=payload)\nprint(response.json())\n\n# Deleting a person\nuser_id = 1\nurl = f\"https://brianobot.pythonanywhere.com/api/{user_id}/\"\nresponse = requests.delete(url)\nprint(response.json())\n```\n\n## Error Handling\n\n- **400 Bad Request:** If the request is malformed or missing required fields.\n- **404 Not Found:** If the requested `Person` does not exist.\n- **405 Method Not Allowed:** If an unsupported HTTP method is used on an endpoint.\n\n## Testing\n\nTo Run the Automated Test, run the command (from within the project directory terminal)\n```python\npython test.py\n```\n\n## Conclusion\n\nThe Person Webservice provides a simple and easy-to-use interface for managing `Person` objects. It allows for creating, retrieving, updating, and deleting `Person` records through a RESTful API. Use the provided endpoints to interact with the service and manage your `Person` data.\n\n### Maintainer:\n- Brian Obot \u003cbrianobot9@gmail.com\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrianobot%2Fzuri_internship_task_2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrianobot%2Fzuri_internship_task_2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrianobot%2Fzuri_internship_task_2/lists"}