What is a RESTful API?

We worked with APIs before, in Chapter 9, Shell, Git, Conda, and More – at Your Command, as clients. So, it would be safe enough to assume we have some idea about an API: it is just an interface that allows us to exchange data with the service. Technically, APIs can use any protocol or means of communication, and there are plenty of applications with all types of interfaces. However, these days, when people say API, they likely mean RESTful API. Here, the REST part stands for Representational State Transfer. REST is based on six guiding architectural principles, but what is more important for us is that it is based around HTTP requests, similar to the ones our browsers execute when we type in a URL.

Behind each RESTful API is a server—or, most likely, a group of serversready to execute the command; this command could serve the entire, rich HTML page, orin the case of an APIsome information, either as a binary or some other kind of data structure—the most popular ones are XML and JSON. 

The servers behind each API run a corresponding application. Python is a great language to create such an application! As usual, there is a handful of packages designed to help with the making of APIs. Due to the complexity of the task, these tools tend to be more proactive and involved in the process than your average library, so they are usually called frameworks. Indeed, as it is often said, libraries are what you use in your code and frameworks are what you stick your code into. Let's take a look at the assortment of Python web frameworks we can use in the next section.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.116.42.87