Deploy a Web API with Python, Flask, and MongoDB on Heroku in 10 Mins
Step-by-Step Guide to Build an API w/ Python, Flask, and MongoDB on Heroku
Note: The code for this post can be found here
API stands for Application Programming Interface. It is a software intermediary that allows systems to communicate with each other. For example, when a user enters a URL into their browser, e.g. www.medium.com, they are making a GET request to Medium’s server. Medium will then give back a response, which may contain HTML, CSS, JavaScripts, or other assets to be consumed, executed, and rendered on the user’s system. Similarly, when a system makes a request to SpaceX’s Launches API endpoint, it receives Raw Data back in the response. This data can then be used for further processing. In this guided walkthrough, we’ll use Python, Flask, and MongoDB to build a Web API for public consumption. Realizing that individual scripts can be different depending on the type of data and how its used, we take on the approach of walking through a simple example while providing adequate reasoning behind each step.
Background
- Why build a Web API — APIs provide a means for systems to communicate internally as well as externally. They can be implemented to include authentication(s) and limit(s) to validate requests. Due to the rapid advancement…