REST API Example

Note: You can check this project out by clicking here, the data is reset every night back to its original state.

This project is a REST api service written in PHP with a MySQL database. It was written for app dev module at uni which asked us to find source of data that we could provide via a REST api and visualize with a front end.

I chose to do this as a website because I have been doing web development for over a decade now.

The final submission for the site (front end)
The final submission for the site (front end)

The backend PHP uses my bespoke framework that I have built up over the years that gives me easier access to databases via PDO, classes that handle DB, User and System features like logging into an admin section.

Example of the REST core class
Example of the REST core class

Each REST object inherits from the core and have specific http methods that are allowed, only the data points currently allow for editing.

The front end uses TWIG to generate the HTML and SCSS is used to generate the CSS files. A handful of JS libraries are used such as jQuery, Datatables and JSChart.

The front end uses AJAX to make the REST calls and populate the charts and table. You can also export the graph into a PNG using the button, it converts the canvas data into an image for download. This was another piece of course work I ended up getting a 100/100 in.

Example exported graph
Example exported graph

You can check out the front end for the site here: Click here

Tech Used
  • REST
  • MySQL
  • Twig
  • HTML
  • SASS
  • jQuery
  • Bootstrap

Date Written: