I have tried to find an explanation around the Internet; however, I did not find a satisfactory and simple one despite the tons of information.
Till now, I always used ajax calls
as to request data from the server.Since I am using PHP, ajax requests were addressed to PHP files which in their turn were addressed to the database, grabbed the appropriate data and then send it back to me in JSON format. So far so good!
Now, APIs came into my life and I have to cope with them. However, I cannot understand basic things. Let's take a very simple paradigm: https://api.github.com/users. This is an API which returns in JSON format the profile of GitHub users (as to get a certain user's profile we have to write the following URL: https://api.github.com/users/username).
As to consume this API, we have to make an ajax request to the above URL which obviously will run some back end code, get the appropriate data from a database and return it in JSON format. Namely, exactly the same thing as the way I used to work. So:
Please, do not reply to me like search the Internet or there is a lot of stuff about that. I will tell you, once again, that I did not find something good for this very basic questions.