{"id":18777709,"url":"https://github.com/daelsepara/webapi","last_synced_at":"2025-12-17T03:30:12.812Z","repository":{"id":142354128,"uuid":"175387035","full_name":"daelsepara/WebAPI","owner":"daelsepara","description":"Sample WebAPI using C#","archived":false,"fork":false,"pushed_at":"2019-03-21T02:02:58.000Z","size":52,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-29T10:14:07.746Z","etag":null,"topics":["api","rest","webapi"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/daelsepara.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":"2019-03-13T09:20:40.000Z","updated_at":"2021-03-26T07:07:24.000Z","dependencies_parsed_at":"2023-04-16T07:15:40.785Z","dependency_job_id":null,"html_url":"https://github.com/daelsepara/WebAPI","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daelsepara%2FWebAPI","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daelsepara%2FWebAPI/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daelsepara%2FWebAPI/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/daelsepara%2FWebAPI/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/daelsepara","download_url":"https://codeload.github.com/daelsepara/WebAPI/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239690076,"owners_count":19681034,"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","rest","webapi"],"created_at":"2024-11-07T20:13:23.028Z","updated_at":"2025-12-17T03:30:12.678Z","avatar_url":"https://github.com/daelsepara.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WebAPI\n\nThis is a sample project for demonstrating Web APIs. The REST service implemented in C# and responds to **GET**/**POST**/**PUT**/**DELETE** request calls on a single endpoint (_~/prescriptions_). An MySQL server with a database and table named **Prescriptions** is required. To create the table structure, please refer to the .sql file provided: ![migrations.sql](/migrations/migrations.sql)\n\nThe calls operate on the records inside the _Prescriptions_ table. REST calls to the endpoint responds with an **HTTP 200 OK** status code upon success. Different status codes are returned when an error is encountered.\n\nOn rest calls that require authentication, use the following credentials: username: **_test_**, password: _**test123**_\n\nThe input requirements and output of the REST calls as well as the response codes (on error) are listed below.\n\n## GET ~/prescriptions/ ##\nReturns a list of all prescriptions, available in the database.\n\nInput: \u0026lt;empty\u0026gt;\n\nOutput: Array\u0026lt;Prescription\u0026gt;\n\n### Response codes ###\n**HTTP 404 Not found**: if there are no records in the database.\n\n## GET ~/prescriptions/{id} ##\nReturns data for a particular prescription (identified by **_id_**)\n\nInput: \u0026lt;empty\u0026gt;\n\nOutput: Prescription\n\n### Response codes ###\n**HTTP 404 Not found**: if the record does not exist in the database.\n\n\n## POST ~/prescriptions/ ##\nCreates a new prescription. As an input accepts a prescription object in body. The Id field shall not be specified. Output shall be the created object\n\nInput: Prescription\nOutput: Prescription\n\n_**Additional Note:**_ requires basic authentication (refer to the credentials above)\n### Response codes ###\n**HTTP 400 Bad request**: if fields **ExpirationDate**, **ProductName**, **UsesLeft**, or **Description** are empty.\n\n**HTTP 401 Unauthorized**: if username/password is incorrect or if the call is not authenticated.\n\n## DELETE ~/prescriptions/{id} ##\nDeletes a prescription with the specified identifier.\n\nInput: \u0026lt;empty\u0026gt;\n\nOutput: \u0026lt;empty\u0026gt;\n\n_**Additional Note:**_ requires basic authentication (refer to the credentials above)\n\n### Response codes ###\n**HTTP 401 Unauthorized**: if username/password is incorrect or if the call is not authenticated.\n\n**HTTP 404 Not found**: if the record does not exist in the database.\n\n## PUT ~/prescriptions/{id} ##\nUpdate aprescription with the specified identifier. Accepts a prescription object in body. New values specified in the prescription object will be used to update the record in the database.\n\nInput: Prescription\n\nOutput: \u0026lt;empty\u0026gt;\n\n_**Additional Note:**_ requires basic authentication (refer to the credentials above)\n\n### Response codes ###\n**HTTP 400 Bad request**: if no prescription object is passed as input.\n\n**HTTP 401 Unauthorized**: if username/password is incorrect or if the call is not authenticated.\n\n**HTTP 404 Not found**: if the record does not exist in the database.\n\n# Testing\n\nOpen the solution file: ![PrescriptionsApp.sln](/PrescriptionsApp.sln) provided in Visual Studio 2015/2017 then modify the connection string in the ![prescriptionsController.cs](/PrescriptionsApp/Controllers/prescriptionsController.cs) file and modify the **{username}** and **{password}** placeholders in the code:\n\n```C#\nreadonly string connectionString = \"server=127.0.0.1;uid={username};pwd={password};database=Prescriptions\";\n```\n\nRun the Debug/Release version. Visual Studio runs IISExpress on a separate browser window. Take note of the URL, e.g. http://localhost:port. Use the URL provided and make request calls to the /prescriptions end point, e.g. http://localhost:port/prescriptions\n\nTo create GET/POST/DELETE/PUT requests (with/without authentication), you can use the free version of the Postman software downloadable at: [https://www.getpostman.com/](https://www.getpostman.com/) \n\n# Dependencies\n\nUses Newtonsoft Json library to serialize objects into a JSON string. It is automatically downloaded during build/deployment.\n\n# Deployment\n\n*TODO*\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaelsepara%2Fwebapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdaelsepara%2Fwebapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdaelsepara%2Fwebapi/lists"}