Hello everyone and welcome back to my blog. Last week we talked about APIs in Activity 12 and I want to go more in depth about APIs and what a REST API is since I don’t really know what they are. API stands for Application Programming Interface and it is a set of definitions that allows two applications to talk to each other. Almost every application uses an API to communicate data from your device to a server. The server has its own APIs to receive that data and interpret it, and then send it back to your device. Then the application translates that data into a readable format for you. You do not have to know how they are implemented into your application, which can simplify the application development and save a lot of time.
APIs can also give security by only allowing certain data through and not all the data. For example, when you buy an item on an online store, you tell the store what items you want to buy and the store tells you what you need to pay. No other information from either your device or the website’s databases is transferred over. What I find interesting about APIs is how they work in video games. There can be multiple APIs in a game that each do something different, such as managing a game’s sound, rendering, and graphics, while others manage AI tasks such as path-finding. Pokemon is one of the most popular video game series out there and there is an API called “Poke API” that has every single Pokemon listing with moves, types, and weaknesses as well as every item in the games. A Pokemon website can use that API to easily get the latest updated information about Pokemon and the games.
REST API or RESTful API stands for Representational State Transfer API. It usually takes advantage of HTTP when used for Web APIs. This means that developers do not need to install libraries or additional software in order to take advantage of a REST API design. However, not all APIs can be REST APIs. In order for an API to be RESTful, it has to follow certain criteria. The client and the server should be separate from each other and allowed to evolve individually and independently, meaning making changes to the database won’t affect the clients. Stateless client-server communication, meaning no client information is stored between get requests and each request is separate and unconnected. Cacheable data that streamlines client-server interactions. A uniform interface which lets the client talk to the server in a single language, standardized means of communicating between the client and the server. A layered system that organizes each type of server. And lastly, Code-on-demand, which is the ability to send executable code from the server to the client when requested. All of these define what REST APIs do.
https://www.redhat.com/en/topics/api/what-is-a-rest-api
From the blog Comfy Blog by and used with permission of the author. All other rights reserved by the author.