It’s an Application Programming Interface.
Ok, but what *is* that?
A quick article for new programmers, and those who are just curious. 👇
APIs are actually quite easy to understand.
An API can be thought of as the middleman of communication between two systems. APIs allow devices, web servers, and software to talk with each other. They are the drivers of many of the digital systems we use today.
An example of an API being used: The weather app on your phone retrieving the most recent weather report.
Another example: Pay with PayPal integrated with an eCommerce store.
The underlying code of APIs states the rules for communication and only allow developers to commit certain actions.
When working with APIs, you don’t have access to the internals of the system, therefore you don’t know what is going on behind the scenes. The API does what it needs to do in the background, and you only see the result of using the API. The need to use an API would arise when there is a system you want to communicate with, but you are not given access to the system’s internals or underlying code.
APIs are communication bridges that work off of endpoints.
Endpoints are the point of contact where developers submit their inputs to the API. Each endpoint has a protocol, or set of rules, that the dev must follow when submitting inputs. If the input sent from the developer does not match up with what the API is expecting, then your request will not go through. Some APIs require API keys, which authenticate and keep track of who is accessing the endpoints.
What does an endpoint look like?
An API endpoint looks like: https://api.spacexdata.com/v4/starlink.
Some endpoints take parameters as inputs — which help query certain data: https://api.spacexdata.com/v4/starlink/5eed7716096e590006985825. The number is the parameter. This endpoint returns data on a specific Starlink satellite.
An example using a different API. Here, parameters are used for a much more specified query: http://newsapi.org/v2/everything?q=spacex&from=2021-01-26&to=2021-02-13&sortBy=popularity This would return all of the articles that mention SpaceX, from Jan. 26, 2021, to Feb. 13, 2021.
The data returned from APIs is usually in the JSON format. If you don’t know what JSON is, you should; as it’s an integral part of software engineering.
Here are some resources that you may want to check out if you’re interested in learning more about APIs & JSON:
- Intro to APIs, What is an API: https://blog.postman.com/intro-to-apis-what-is-an-api/.
- API, Wikipedia Article: https://en.wikipedia.org/wiki/API.
- What is an API and how does it work: https://www.youtube.com/watch?v=Yzx7ihtCGBs.
- What is JSON: https://www.w3schools.com/whatis/whatis_json.asp.