{"id":25746124,"url":"https://github.com/onurozuduru/reservation-api","last_synced_at":"2026-06-11T03:31:30.319Z","repository":{"id":149506086,"uuid":"95952101","full_name":"onurozuduru/reservation-api","owner":"onurozuduru","description":"Room reservation API project for PWP course.","archived":false,"fork":false,"pushed_at":"2017-07-01T09:52:15.000Z","size":553,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-26T11:37:17.011Z","etag":null,"topics":["backend","hypermedia","hypermedia-api","python","rest-api","rest-client","restful","web-programming"],"latest_commit_sha":null,"homepage":"","language":"Python","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/onurozuduru.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":"2017-07-01T08:30:56.000Z","updated_at":"2017-07-01T09:44:13.000Z","dependencies_parsed_at":"2023-07-03T23:20:26.791Z","dependency_job_id":null,"html_url":"https://github.com/onurozuduru/reservation-api","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/onurozuduru/reservation-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onurozuduru%2Freservation-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onurozuduru%2Freservation-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onurozuduru%2Freservation-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onurozuduru%2Freservation-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/onurozuduru","download_url":"https://codeload.github.com/onurozuduru/reservation-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/onurozuduru%2Freservation-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34181554,"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-11T02:00:06.485Z","response_time":57,"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":["backend","hypermedia","hypermedia-api","python","rest-api","rest-client","restful","web-programming"],"created_at":"2025-02-26T11:29:57.796Z","updated_at":"2026-06-11T03:31:30.307Z","avatar_url":"https://github.com/onurozuduru.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Tellus Room Reservation API\n\n## Info about Project and Course\n\nThis was our project with [Lam Huynh](https://github.com/HuynhLam) for Programmable Web Project Course (PWP).\nThe project idea was designing and implementing a reservation API for study center (Tellus) in University of Oulu.\nWe used design first approach for this project, in this repo we only share the code part.\n\nPlease be aware that this was a course project so **all functionality could not be implemented, because of time restrictions**\npoint was to learn how to make a web project. Implemented methods are listed under [Implemented Methods](#implemented-methods)\nsection.\n\nIn the course, it was allowed to barrow code snippets from exercises. We marked them inside the code with comments,\nthese parts belong to course instructors \n[Iván Sánchez](http://www.oulu.fi/cse/personnel/iv%C3%A1n-s%C3%A1nchez) and \n[Mika Oja](http://www.oulu.fi/cse/personnel/mika-oja).\n\nAll codes and the below explanations are submitted as code work for the project and published\nafter end of the course and grading.\n\n**Developers:**\n\n- [Onur Özüduru](https://github.com/HuynhLam)\n- [Lam Huynh](https://github.com/HuynhLam)\n\n# Room Reservation API\n\nIt consists of 2 APIs, one to interact with the database and the other the main API which provides resources.\nBoth of them are explained below, please note that the section *How to Use* explains \nhow to setup and use resources while section *Database API* explains how to setup and handle \ndatabase interactions.\n\nThe following part explains the *Reservation API* in general, please note that it depends on \n*Database API* so, **before running `resources.py` make sure that *Database API* is working.** \n\nAn example client is provided in this project. Since focus is on API, details about example client \ncan be found under the section *Example Client*.\n\n**To read more about *Database API*, please see the section [Database API](#database-api) in this Readme file.**\n\n## Tellus Room Reservation API Documentation\n\nThe documentation of the API can be found in \n[Tellus Room Reservation API Documentation page.](http://docs.tellusreservationapi.apiary.io/#)\n\n## List of Resources\n\nThe following resources are provided by the API.\n\n![resources list](https://github.com/onurozuduru/reservation-api/blob/master/documentation/resources_list.png)\n\n## Implemented Methods\n\nBecause of the time restrictions, not all methods are implemented. \nThe below table shows available methods under resources.\n\n![implemented methods](https://github.com/onurozuduru/reservation-api/blob/master/documentation/methods.png)\n\n\n## Requirements\n\nTo run API, the following tools are needed:\n\n* [Python 2.7.X](https://www.python.org/download/releases/2.7/)\n* [sqlite3](https://www.sqlite.org/)\n\nFor Python the following additional libraries are needed.\n\n* [sqlite3](https://docs.python.org/2/library/sqlite3.html)\n* [Flask](http://flask.pocoo.org/)\n* [Flask-RESTful](https://flask-restful.readthedocs.io/en/0.3.5/)\n\n### How to Use\n\n* [Cloning Repo](#cloning-repo)\n* [Checking Structure](#checking-structure)\n* [Creating Database Tables and Populating Them](#creating-database-tables-and-populating-them)\n* [Database API](#using-database-api)\n* [Using Tellus Room Reservation API](#using-tellus-room-reservation-api)\n* [Running Tests](#running-tests)\n\n#### Cloning Repo\n\nThe easiest way to download code is cloning the repo directly from source \nwith `git clone` command.\n\nWe are providing some _bash scripts_ to make developers' life easier.\nIf you want to use them, you must give execute permissions to these scripts.\n\n```bash\n    $ cd project\n    $ chmod +x check_file_structure.sh\n    $ chmod +x create_and_populate_db.sh\n    $ chmod +x run_tests.sh\n    $ chmod +x run_tests_api_resources.sh\n    $ chmod +x check_client_file_structure.sh\n```\n\n_project_ is the name of the folder which includes all codes.\n\n#### Checking Structure\n\nTo make sure that every folder and file are in the right place, the script\nnamed **check_file_structure.sh** can be run.\n\n```bash\n    $ ./check_file_structure.sh\n```\n\nIt gives error message if one of the important file is missing and it inform \nuser with a warning if file is missing but API can work without it.\n\n\u003e **Please note that, this script only checks for API files.**\n\u003e **To check structure of client part, please read _Check File Structure of Client_ under section _Example Client_**.\n\n#### Creating Database Tables and Populating Them\n\nDatabase tables can be created from **tellus_schema_dump.sql** under database\nfolder. And after that it can be populated with **tellus_data_dump.sql**.\nWe recommend to use **create_and_populate_db.sh** script for doing this.\n\n```bash\n    $ ./create_and_populate_db.sh\n```\n\nHowever, it is also possible to do these manually.\n\n```bash\n    $ cat database/tellus_schema_dump.sql | sqlite3 tellus.db\n    $ cat database/tellus_data_dump.sql | sqlite3 tellus.db\n```\n\n\n#### Database API\n\nWe are providing an API to interact with database. Instead of interacting with \ndatabase directly, it is possible to do changes via Python with Database API.\n\n##### Using Database API\n\nTo interact with database, it is needed to create `Engine` object and to make\nchanges on database a _connection_ is needed. `Engine` object takes database \npath as argument. An example usage is given below under python shell.\n\n```python\n    \u003e\u003e\u003e import reservation.database as database\n    \u003e\u003e\u003e engine = database.Engine()\n    \u003e\u003e\u003e con = engine.connect()\n```\n\nAfter the connection object created, it is possible to interact with database.\nFor example, a user can be removed from database as follows.\n\n```python\n    \u003e\u003e\u003e con.delete_user(username='Trump')\n```\n\n#### Using Tellus Room Reservation API\n\nTo run API, it is needed to run `resources.py` via `python` command. \n\n```bash\n    $ python reservation/resources.py\n```\n\nAn example output of the above command can be like that:\n\n```bash\n    * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)\n    * Restarting with stat\n    * Debugger is active!\n    * Debugger pin code: 204-872-798\n```\n\nAs it can be recognize from the example output, API runs in debug mode \nautomatically. To turn off debug mode, following line in `resources.py` \nmust be modified as `app.debug = False`\n\n```python\n    app.debug = True\n```\n\n\u003e **Warning**\n\u003e\n\u003e Debug mode should never be used in a production environment!\n\nAfter application run in the command-line, it will run under `port 5000` in `localhost`.\n\nURL to access the API is **`/tellus/api/`**\n\nFor example if you visit `http://localhost:5000/tellus/api/bookings/` \nin your browser, or send GET request via `curl`, it will return list of bookings.\n\n```bash\n    $ curl http://localhost:5000/tellus/api/bookings/\n```\n\n#### Running Tests\n\nTests are places under _tests_ directory. We highly recommend to use \n**run_tests.sh** script to run tests, since before running each test file\nit is needed to create a test database. Test database includes initial elements \nof _tellus.db_ so, it can be created from **tellus_schema_dump.sql** and \n**tellus_data_dump.sql** with the name **test_tellus.db**.\n\nTo run tests easily, you can call **run_tests.sh** script from terminal.\n\n```bash\n    $ ./run_tests.sh\n```\n\n##### Running Only the Resource Tests\n\nOther than **run_tests.sh** which runs all tests including Database API tests, \nwe are providing **run_tests_api_resources.sh** which only runs tests that \nare related with `resources.py`. The reason why to provide this script is \nproviding a clear output for resource tests.\n\n```bash\n    $ ./run_tests_api_resources.sh\n```\n\n### Example Client\n\nIn addition to backend code, example client is also provided. Since client does \nnot affect of running API, it will be explained in this section. **Please note that, \nthis is just an example client which only uses 4 resources from the API.**\n\nThe point of having this client is giving an example to work with API and \nshowing that it is okay to work with hypermedia responses. Therefore, it is a hypermedia \nclient which means it creates possible next stages based on `controls` under response.\n\nThe code can be found under `example_client` folder.\n\nIn addition the client uses Chuck Norris jokes database RESTful API to provide random jokes. \nIt is provided by `https://api.icndb.com` as entrypoint of the API. Documentation can be found \nin [http://www.icndb.com/api/](http://www.icndb.com/api/).\n\nThe `getJoke(apiurl)` function under `example_client.js` uses this additional API to \nfetch one random joke and to put it to header of page.\n\n#### Dependencies\n\nThe client code depends:\n\n* [jQuery](https://jquery.com/)\n\nThe compressed edition of version jQuery 3.2.1 has already provided under `example_client/js/` \nfolder. If it cannot be found its place, it is possible to download from \n[jQuery download page](https://jquery.com/download/).\n\n#### Used Resources\n\nThe below table shows which resources and methods are used by which functions \nunder `example_client.js`.\n\nResource Name | HTTP Method | Function Name\n------------- | ----------- | -------------\nRooms List | GET | `getRooms`\nBookings of Room | GET | `getRoomBookings`\nBookings of Room | POST | `addBooking`\nBooking of Room | DELETE | `deleteBooking`\nRoom | PUT | `modifyRoom`\n\n\n#### Check File Structure of Client\n\nTo make sure that every folder and file are in the right place for the client, the script\nnamed **check_client_file_structure.sh** can be run.\n\nFirst give it to execute permission.\n\n```bash\n    $ cd project\n    $ chmod +x check_client_file_structure.sh\n```\n\n_project_ is the name of the folder which includes all codes.\n\nThen run it with the following command.\n\n```bash\n    $ ./check_client_file_structure.sh\n```\n\nIt gives error message if one of the important file is missing for client and it inform \nuser with a warning if file is missing but Client can work without it.\n\n#### How to Run API with Client\n\nThe client is static and creates possible next step codes dynamically from responses \nvia javascript. Therefore, middleware dispatcher is needed to run client and server codes \nat the same time.\n\nTo run client with API backend, it is needed to run `run_with_client.py` with `python` command.\n\n\n```bash\n    $ python run_with_client.py\n```\n\nAn example output of the above command can be like that:\n\n```bash\n     * Running on http://localhost:5000/ (Press CTRL+C to quit)\n     * Restarting with stat\n     * Debugger is active!\n     * Debugger pin code: 294-477-169\n```\n\nIt is same output with running only the API part, however if the page `index.html` opens \nin web browser with going `http://localhost:5000/example_client/index.html`, the below \nexample output might be given by server. This means that, it serves client and API \nat the same time.\n\n```bash\n    127.0.0.1 - - [11/May/2017 21:50:20] \"GET /example_client/index.html HTTP/1.1\" 200 -\n    127.0.0.1 - - [11/May/2017 21:50:20] \"GET /example_client/css/ui.css HTTP/1.1\" 200 -\n    127.0.0.1 - - [11/May/2017 21:50:20] \"GET /example_client/js/jquery-3.2.1.min.js HTTP/1.1\" 200 -\n    127.0.0.1 - - [11/May/2017 21:50:20] \"GET /example_client/js/example_client.js HTTP/1.1\" 200 -\n    127.0.0.1 - - [11/May/2017 21:50:20] \"GET /tellus/api/rooms/ HTTP/1.1\" 200 -\n```\n\n##### Screenshots of Example Client\n\nSome screenshots can be found below.\n\n![screenshot0_of_client](https://github.com/onurozuduru/reservation-api/blob/master/example_client/screenshots/screenshot0.png)\n\n![screenshot1_of_client](https://github.com/onurozuduru/reservation-api/blob/master/example_client/screenshots/screenshot1.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonurozuduru%2Freservation-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fonurozuduru%2Freservation-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fonurozuduru%2Freservation-api/lists"}