{"id":20669155,"url":"https://github.com/erikdelange/restful-web-service","last_synced_at":"2026-06-08T14:32:38.482Z","repository":{"id":129085224,"uuid":"103939709","full_name":"erikdelange/RESTful-Web-Service","owner":"erikdelange","description":"An example RESTful web service plus a web app which is making use of this service. Allows you to maintain a todo list.","archived":false,"fork":false,"pushed_at":"2022-07-22T19:26:41.000Z","size":54,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-17T16:17:35.130Z","etag":null,"topics":["bottle","gui","python","restful-api","restful-webservices","webservice"],"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/erikdelange.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":"2017-09-18T13:01:37.000Z","updated_at":"2022-07-22T19:26:44.000Z","dependencies_parsed_at":"2023-07-26T13:15:21.033Z","dependency_job_id":null,"html_url":"https://github.com/erikdelange/RESTful-Web-Service","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/erikdelange/RESTful-Web-Service","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikdelange%2FRESTful-Web-Service","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikdelange%2FRESTful-Web-Service/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikdelange%2FRESTful-Web-Service/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikdelange%2FRESTful-Web-Service/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/erikdelange","download_url":"https://codeload.github.com/erikdelange/RESTful-Web-Service/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/erikdelange%2FRESTful-Web-Service/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34067348,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-08T02:00:07.615Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["bottle","gui","python","restful-api","restful-webservices","webservice"],"created_at":"2024-11-16T20:13:13.226Z","updated_at":"2026-06-08T14:32:38.246Z","avatar_url":"https://github.com/erikdelange.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RESTful web service example\r\n\r\nEver wondered how to build a web service and how to communicate with it? Then have a look at this Python project which contains:\r\n- A minimal RESTful web service (*server.py*) to maintain a todo list. Only four calls are implemented: retrieving the content of one or all tasks and adding, editing and deleting tasks.\r\n- An app which provides a web-UI (*client.py*) to view and maintain the todo list, using calls to the web service.\r\n\r\nThe web service and UI-app are built using the *Bottle* web framework.\r\nAll responses from the web service are structured following the *JSend* conventions (see: https://github.com/omniti-labs/jsend).\r\nThe Bottle web page templates (*.tpl) are built on top of the Bootstrap framework.\r\n\r\nWithin this project the directory structure for the web service and the UI application server are mixed.\r\nSee below the relevant parts for each of them. Note that certain files are used for both the UI and the server.\r\n\r\n##### WEB service\r\n\r\n    db\\\r\n        __init__.py\r\n        task.py\r\n    jsend.py\r\n    server.py\r\n\r\n    todo.db\r\n    todo.sql\r\n\r\nThe core code of the web service resides in *server.py*. Task information is read from - and written to the *task* table in an SQLite database via calls to *db\\task.py*. When the web service is started it first tries to connect to the task database. If this database cannot be found - either because it really is not there or you've chosen to connect to an in-memory database - SQL file todo.sql will be executed. It contains the statements needed to create and fill the todo database. If you want to take a look at the database itself I recommend using freeware SQLite database manager SQLiteStudio.\r\n\r\nWhen successful a call to the webservice, like retrieving the information for task 1 via http://127.0.0.10:8080/task/1, will return:\r\n```\r\n{\"status\": \"success\",\r\n  \"data\": {\"id\": 1, \"summary\": \"Read\", \"description\": \"Read something to get a good introduction into Python\",\r\n           \"duedate\": \"2020-01-01\", \"status_id\": \"C\", \"modified\": \"2017-09-18T09:10:20\"}}\r\n```\r\n\r\nAn unsuccessful calls' return value looks like:\r\n```\r\n{\"status\": \"fail\", \"data\": \"task 10 not found\"}\r\n```\r\n\r\n##### UI application server\r\n\r\n    api\\\r\n        __init__.py\r\n        task.py\r\n    views\\\r\n        *.tpl\r\n    jsend.py\r\n    client.py\r\n\r\nFile *client.py* contains the app server. Calls to the web service are made via *api\\task.py*. Directory *views* contains the html code of the various web pages.\r\n\r\nThe landing page of the UI looks like:\r\n\r\n![ui.png](ui.png)\r\n\r\nTo run the server and the GUI use the Windows command prompt:\r\n```\r\n\u003e start python server.py\r\n\u003e start python client.py\r\n```\r\nThe server listens to address 127.0.0.10:8080. To view the UI start your browser and visit localhost:8080.\r\nIn the implementation as uploaded here the tasks database *todo.db* is not needed. Whenever the server is started an in-memory SQLite database is created and populated from todo.sql. In this way you can experiment without destroying data.\r\n\r\n##### References\r\n\r\n* http://www.restapitutorial.com/\r\n* https://labs.omniti.com/labs/jsend\r\n* https://www.toptal.com/bottle/building-a-rest-api-with-bottle-framework\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferikdelange%2Frestful-web-service","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ferikdelange%2Frestful-web-service","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ferikdelange%2Frestful-web-service/lists"}