Hey Everyone. So, today we are back again with some interesting topic. so we are living in a world of internet where the Internet is having everything and having access to the internet. we have desktop, tablet, and mobile, and our world is not inside our mobile that means the internet works on a simple protocol which is called Hypertext Transfer Protocol or simply HTTP and think about protocol just as the rules because rules are rules but at the beginning of the internet, it was designed to share information between one computer to another computer placed apart but because we are living in it 20:17 and this means we need machine to machine talking and what is that suppose you have one machine and under machine both machines work on a different kind of operating system different language different situations and they have to jail the data between these two and all these processes happen without the involvement of the humans but you know the actual city of any machine is its software so actually we need software’s to dock that’s cool.
we the humans can talk to machine by using the browser and not this kind of human and whenever you request any page fly a browser you will get the data along with that HTML and Caesar because each cable ceases is intended to design to have the page looks more readable for human but machine needs machine-readable data so what we have to do if you have to think about that here comes our API and what is an API? An API is application programming interface and you know interface means connecting any network to and that’s exactly what we want but what an API can do for us. we are providing set Android API’s list in the article.
API allows a software program to communicate with each other and what exactly our sole purpose. API can be local and web and program. We are only talking about the web API but what web API can do for us so suppose you have a website all you have a mobile app and in mobile app you want to get the weather information and then Google map for your user but your device cannot have a sensor to sense the weather information and even it has it can sense only the information where the mobile is placed not the information of the whole world but there are some website which can give you the data or the weather information of any city in the world so here is the interesting point.
API as a waiter who can take the order from you go to kitchen and come back with the order you have placed similarly Web API can get the request from a machine go back to server and get back the data to the requested machine but what we have to do to create an API actually we know that there are many developers in the world having knowledge of various kinds of languages so we need a concept or a structured way of creating an API so that everyone in this world that means every developer can swallow that way here comes our hero called rest. An API is also a set of rules or specification or a contract to be followed to return some data or do some action just as user interfaces for users to utilize. An API hides or complexity inside its modules so the developers need not worry about it is not possible for the developer to change the API.
He or she can only use the API is are available for Hardware operating system database management systems and other software. we can send a request to the API programmatically and the API can send a structured response to our request the good thing is that the system website layout can change frequently but the API request format and API response format stay the same so what software program continues to work without needing any changes. let us see some popular API’s these include Microsoft Windows API C++ standard template library Java API is like Java database connectivity or JDBC API and Java remote method invocation.
API or Java RMI API there are web API is like Google Maps, Twitter and YouTube and smartphone API is like API to provide the users current GPS coordinates. let us see how to use an API now as computer and smartphone users we already use API s– for example when we copy from one open program window to and paste to another program window it is a windows api that does the work as developers if we want to use an api we can read the relevant api documentation to see the functionality is available in api classes and api methods for each functionality.
what is the message format to send and the expected response format or error format example code snippets and usage notes as well as limitations on using the API now let us see an example of calling windows API now I’m using Excel Microsoft Office application it can run Visual Basic for applications or VBA code now first we have to declare the API function that we need to use then call that function in our code now here there is a declaration for gate computer name it’s coming from the windows api kernel32 so this is the declaration now here I’ve written the function fetches computer name and basically there are a couple of declarations of variables the response and then name and Here I am calling the API function get computer name now gate computer name puts the computer name and STR name variable and that I assign back to the function name so let us call it in the immediate window so we can just put question mark and the function name and it gives me comm PC which is the name of my computer or whatever is the computer name that you have specified similarly I have used the declaration for the Windows API function get temp path it’s also in the same windows API library and I’ve used get temp path within my fetch temp path function that I have written now in this function again there are a couple of variables and Here I am calling get temp path windows API function so this puts the temporary path in the STR path variable and this, I assign back – the name of my function so here we can see what is the temp path.
we saw what is an API why API’s are required some well-known Android API’s list we can use API documentation to learn about a specific API and we saw code example to call Windows API that’s all in this article.