An application programming interface (API) is defined as an interface that handles the interactions between two or more intermediaries — commonly between a user and a database. More commonly, most websites that are accessed, video games that are played, or even video’s which are streamed involve some level of an API being utilized. As data scientist, we often use APIs to retrieve information such as stock prices, articles, or other types of information. More often than not, data scientists make HTTP requests which generally result in data being returned in the format of a JSON file.
A representational state transfer (REST) type of API is an architectural style that uses HTTP requests to GET, PUT, POST and DELETE data (Figure #1). As users, we are often experienced with the client-side of an API when it comes to making an HTTP request using software such as Postman, or common Python libraries such as Requests. However, the underlying framework of how a APIs function remains a ‘blackbox’ to most Python developers. The purpose of this article is to explore this area by developing an API from scratch using the Flask framework.
#api #python3 #database #rest-api #flask #programming