DEV Community

BillyGoat12
BillyGoat12

Posted on

API?

What is API?

We as programmers see the word API Quite often in our lives, in fact we will even use it quite often as a programmer. API Stands for application programming interface. Interface is how the client interacts with the option provided without having to know how it works. We programmers also work with many different interfaces and that's where API comes in handy. For example, a developer will write codes that happen when a button is clicked, but what that developer didn't have to do is write the codes that make the button interact if they used an API to do that for them. Basically
API is a way for different programs to work together.

The structure of API

API normally consists of a structure request and response. One software will request for information formatted in this way and it will give the data (response). Certain API is formatted to take only certain requests so the client would have to format the request to accommodate that and anything else would result in some kind of error.

request and response

Think of API as a messenger between the programs and since these messenger takes in requests a certain way. We would have to use rest which in turn let us use HTTP request to format those to format those messages (request). A GET request is used to get or retrieve data from a specified resource. A Post request is used to submit data to be processed to a specified resource. These two can be used to format the API request and response.

API can allow data access

API can be used to access data from third parties. When we were building our own vision of YouTube we used their API to gain access to their data. Even though we coded what we wanted our application to do we lacked a database of videos. API allows different apps and services to exchange information. Anything you would want to look up in specific there is probably an API that can do that for you.

API can perform task

In the app where we created our own version of YouTube we used a media player API provided by our devices. This allows us to play videos without needing to send video data to our software. Also our video was not stored in our devices it was streamed over the internet so we used a web base API to get the data. Another example is instead of writing codes to paint a map in our application we can outsource all of this using google map API.

Security

When you download an app on your phone that uses your camera it would ask the user if they would like to allow this app permission to gain access to this functionality. So every time you get a notification that asks for permission you know that an app is using an API of your phone system. So if you do not want to share certain information then you can deny it to the app.

Conclusion

API is just like how client users access their interface with options provided except for a software application to be able to access the same information the same way the client may access the information but is designed so the software can do it instead. There is basically nowhere on the internet you can go without an API. It is filled with different types of API and we use some of those API.

Top comments (0)