What is API?
When a user connects an application to the internet, it sends data to a server and then the server retrieves the data, interprets it to perform the necessary action, and sends some data back to the application which the user gets. This is how all the applications on your phone all the interactive websites work. API is the medium one application talks to the other application.
Why API & What can I do with it?
As a developer, you must use APIs in your programs to connect your user to the required server. Suppose you want to build an application that lets the users know the currency conversion rate, say EUR to USD. Static data from a dictionary will not help here because the conversion rate changes all the time and of course you don’t want to give your user absolute information from yesterday or last month.
So in this case you find a server that knows what is the currency conversion rate right now. And you let your user send the right request to the server. And the server sends back the required information to your user. In this way, your users do not have to go to the server and find the data they are looking for and the server doesn’t have to send or show gigabytes of data which is costly and time-consuming for the server, for your application, and the user.
How to use API, what do I need?
To use the API to talk to a server you need to send the request to the server in a predefined format so that the server knows exactly what your want and what the server is supposed to return. And most of the APIs want credential key so that the server knows you are the developer of the application the request is coming from and in case the server can charge you.
But be encouraged, there are tons of free APIs and APIs which give you limited access free of cost.
The next day we will learn using first API in your program and what can we do with it. Later we will learn how can we get all the APIs for our projects.