what is API - basic explnanation
IT Explained

REST API, or API – easy explanation

The is highly simplified explanation, but as we know, correct explanation which you don’t understand is useless.

As such API means Application Programming Interface, which means nothing for people who are not involved in software development.

This short article is only about API as used for web development, and I don’t dive deeply into sub detailed quantum levels of the technology.

So, what API means in terms of web development? Well, to cut long story short API means a method in which websites, or web services in general, can communicate between themselves. The communication is limited usually to data exchange, for instance site A asks (“request”) site B about some bunch of data, and after on site B was verified that caller (site A) is OK (“authentication” and/or “authorization”), site B sends (“response”) the data to site A.

Site B doesn’t care who asks, as long as site A provides some kind of verification key, or username and password (for “authentication” and/or “authorization”)

What is usually sent is just raw data, in form of text, for instance list of products and prices, or list of users and details of their IDs, or list of flight connections for a given day. Basically any kind of digital stuff can be sent via API, and most often it is just commercial data.

Why API is so useful? Well, imagine that you have an online shop (website B) with car parts for sale. And you would like to enable information about your products (prices, descriptions etc) on some other website – let’s name the other site as A. And let’s assume that you have agreement with owner of site A, that the owner gets some commission after successful sale. This way you can sell more. Thanks to API you don’t need to give access to your whole website, with database and all passwords included. It is enough if on your site you have special code which gets required information from your database and wrap it in such way, that it is ready to be available if site A makes call (request). So, your site sends only raw information via API – for instance formatted in special way list of parts names, prices, descriptions etc., that is – only what you want to make available on the other site, or sites.

But, there is something more – if you have API on your website, also mobile apps can ask about data. In fact, your site can enable data to as many other services/websites/apps/users as you like.

You may ask yourself – why other services, websites, apps etc need only raw data? Well, usually the other services have already some kind of layout, or user interfaces and they just want to embed the data into their layout/template, so everything is consistent with other parts of their website (or mobile app) and they can decide which bits of the data and in what way will be presented.

So, what is REST API – well, REST API is just API as explained above, but it sticks to some specific rules to make it more reliable and standarized.

Some kinds of data, or information in general, can be available for everybody. For instance, below you can see this post in raw form as enabled by WordPress API system:


The above URL is sometimes called API “end” – precise location where we have to deliver our credentials with request to get response (data). The data in such raw form maybe doesn’t look beautiful, but is easy to manipulate. The raw data as used in the above example is in JSON format – probably the most popular format for API, but there are more formats.

In JSON format reader the post (below visible only part of it) looks like this:

"id": 773,
"date": "2023-09-22T21:26:07",
"date_gmt": "2023-09-22T20:26:07",
"guid": {
"rendered": "https://www.learningonthebeach.com/?p=773"
"modified": "2023-09-22T21:58:46",
"modified_gmt": "2023-09-22T20:58:46",
"slug": "rest-api-or-api-easy-explanation",
"status": "publish",
"type": "post",
"link": "https://www.learningonthebeach.com/rest-api-or-api-easy-explanation/",
"title": {
"rendered": "REST API, or API – easy explanation"