Skip navigation

API, explained.

Published 2021/07/14 12:00

What is API?

Let's explain!

So a friend comes up to you and says

"I heard you create websites. Can you make me one?"

You, being a good friend, happily agree. You agree on the details and you get cracking with the website…

After a month or so, you complete the work. You show the website to your friend.

Your friend is mindblown! His pupils dilate at the site of his new amazing website that you have built for him.

You have the feeling of pride that your creation has made your close friend happy

After a few days, you get a phone call from your friend:

"Hey! Remember you made a website for me? It's great! But I have a Twitter account, and I was wondering if you could add the number of followers at the top right?"

You think it's a great idea so you agree to do it!

Thing is, how are you going to grab the number of followers and add it to his website?

You put your brain to work on possible ways…

Should you hardcode the number of followers to the website?

Sure that could work, BUT…

Are you willing to constantly get to the website's code and change that number?

No? Then that's probably not the answer…

Should you somehow automatically go to your friend's Twitter profile regularly, grab the follower count and put in on the website?

Sure that's a viable option. But it's an unstable solution that will become useless once Twitter decides to change to their website.

You need to somehow have Twitter send this information to you in a reliable way.

Thankfully, Twitter has a functionality to easily get and post information such as tweets, followers and other useful stuff.

Such a tool is called an API (Application Programming Interface)!

So you read through the documentation of the Twitter API and sure enough, there's a easy way to grab the follower count of your friend's account with just a URL.

So you set up a scheduled process which grabs the follower count and adds it to your friend's website.

Finally you show this to your friend and once again, he is happier than ever!

A job well done!

APIs are basically a façade programmers can use to make accessing a complex system easier.

APIs are tools used by almost all popular websites. Here are some examples:

I hope this article made API a little easier to understand. Thank you for reading! 👋👋👋

Explained (28 part series)

  1. Javascript Scopes, explained.
  2. Javascript Promises, explained.
  3. Accessibility, explained.
  4. React, explained
  5. Should I use forEach() or map()?
  6. Should I use Flexbox or CSS Grid?
  7. Docker, explained.
  8. Unit testing, explained
  9. Git, explained.
  10. Typescript, explained.
  11. async/await, explained.
  12. The DOM, explained.
  13. Regular expressions, explained
  14. GraphQL, explained.
  15. Vue, explained.
  16. Svelte, explained.
  17. API, explained.
  18. Javascript Hosting, explained.
  19. Immediately Invoked Function Expressions (IIFE), explained.
  20. ARIA roles, explained.
  21. Test-driven Development, explained.
  22. ARIA live regions, explained.
  23. aria-label in accessibility, explained.
  24. Type coercion in Javascript, explained.
  25. Variables, explained.
  26. if statements, explained.
  27. Arrays, explained.
  28. Currying in Javascript, explained.
2021 Savvas Stephanides
Buy me a coffee
Some icons from Freepik