API and Memory Cache Implementation

In implementing our API, fortunately for us, most of our RESTful endpoints had already been implemented, thanks to Flask’s easy creating of routes to modify and access our back end database. Because of this, we had no need for an API generator when building our API, since Flask let us build our routes while simultaneously developing our Model-View Controller. Our API routes were built with the intention of allowing easy access to back end data while making it easy for front end developers to do so. With our current routes, it’s easy to post new data to the databases, pull all the data from the databases, and also grab specific elements, should the front end need them. After building routes in Flask, the team would strongly recommend Flask as an easy and efficient API building method, instead of having to source a third-party software to build an API.

For our API documentation, we wanted to clearly explain each endpoint’s capabilities and requirements. We detailed the parameters each route requires and what they return (if anything). Examples have also been provided for what each endpoint is used for and what they could be used for in future implementations. We also provided examples of specific use cases, showing what is sent to and what is received from the server. We were heavily inspired by Blizzard’s battle.net API in regards to styling and content formatting.

Regarding our implementation of caching, we installed the Memcachier add-on to our Heroku web application and implemented the corresponding Python add-ons for Flask. We used caching for many of our GET requests, most importantly the “Get Machine” request, as this is important when a user checks in to a machine. Since we can assume when a user checks into a machine, they will check out soon after, caching is very useful in this case to ensure a speedy transaction. Unfortunately, despite the implementation, our relevant GET requests involving Memcachier received negligible improvements in response time, though we will continue to look into ways to improve the effectiveness of our cache.

Our API documentation can be found here:   https://strongsloth.herokuapp.com/api_documentation

Leave a comment