Logo
Logo
Home
Archive
Advertise
YouTube
Login
Sign Up
  • Home
  • Posts
  • 🦥 Understanding APIs

🦥 Understanding APIs

May 28, 2024

Hello friends!

Another week, another Sloth Bytes.

Seems that a majority wanted to keep weekly challenges/projects, so I’ll keep them.

If you have any other suggestions let me know by replying!

Sloths Can Turn Green

Giphy

Sloths can grow a layer of algae as a camouflage method to help protect them from predators and gives sloths extra nutrients through their skin.

APIs

An API stands for Application Programming Interface.

Good to know I guess? Everyone just calls it an API.

This week we’ll keep it simple by covering the basics, but later on I’ll dive deeper since these can get pretty complicated.

What is an API?

APIs are like the middlemen of the digital world, they allow the front end (what users interact with) and the back end (where data processes happen) to communicate effectively.

A Cooking Analogy

Think of an API as a waiter in a restaurant.

The kitchen is the back end where your food is prepared, and the dining area is the front end where you sit and order.

The waiter (API) takes your order to the kitchen and brings back your food.

In programming, APIs take user requests from the front end, fetch the required data or action from the back end, and deliver the results back to the front end.

Why are APIs important?

  • Simplicity: APIs allow front-end developers to not worry about the database or server-side details. They simply send requests and handle responses.

  • Efficiency: Data fetching and management are handled more efficiently. Since APIs can communicate seamlessly between the server (back end) and the client (front end), it makes applications faster and more responsive.

  • Flexibility: Developers can quickly implement features that rely on external services (like social media logins, maps, or payment systems) without starting from scratch. This is why a lot of services offer “developer APIs.” Makes it really easy to add their service to our own application.

Example: Getting a random emoji from an API

Let’s do an easy example of how APIs work.

Here’s a simple fetch to get a random emoji from a free API (in JavaScript of course)

//Extra tip: It's usually common to name the fetch either "response" or "res" (short for response) :)
const response = await fetch("https://emojihub.yurace.pro/api/random")
const emoji = await response.json();
console.log(emoji)

This will give us information about a random emoji.

Wanna try it out?

Copy that code snippet and open up the developer tools console.

How I do that I’m a little dumb

Mac

Windows

Command + Option + J

Control + Shift + J

or

  • right click

  • Click inspect or inspect element

  • Go to the console

Once you’re in the console, paste that code snippet 😄

or you know… paste it into the IDE, that’s cool too.

Here’s an example of the information you’d get from it:

{
    "name": "oncoming fist, type-6",
    "category": "smileys and people",
    "group": "body",
    "htmlCode": [
        "👊",
        "🏿"
    ],
    "unicode": [
        "U+1F44A",
        "U+1F3FF"
    ]
}

Now you can use that information for your own application!

Alright cool, why should I care about this?

  1. Essential Tools: APIs are crucial for making different software systems work together. Basically every company relies on them heavily.

  2. Boost Your Career: Knowing how to use APIs is a must-have skill if you want to be a web/mobile developer.

In Summary: APIs are the middlemen that communicate between the front end and back end which makes development easier.

Angular v18 is now available! (12 minute read)

Today we are excited to share the next milestone in the evolution of Angular! Over the past three releases we’ve introduced a lot of new…

Vercel Ship 2024 recap (6 minute read)

Vercel Ship 2024 highlighted the integrations, ecosystem, and teams building the web's best products. Read the recap to catch up on all our announcements.

Microsoft Build 2024: everything announced (8 minute read)

Finally, Teams is adding custom emoji.

Mistral AI and Harvey Partnership (1 minute read)

Harvey builds custom LLMs for elite law firms to tackle the most complex legal challenges across every practice area, jurisdiction and legal system in the world.

KREA

KREA – Generative AI made easy. Generate and enhance images and videos using powerful AI for free.

Mediocre Engineer’s guide to HTTPS (13 minute read)

As a mediocre engineer, I took Internet and HTTPS communication for granted and never dove any deeper. Today we’re improving as engineers and learning a rough overview of how internet communication works, specifically focusing on HTTP and TLS.

Best Practices For Naming Design Tokens, Components And Variables — Smashing Magazine (6 minute read)

How can we get better at naming? This post is dedicated to naming conventions, tips, and real-world examples that help you name things in a robust and flexible way.

9 Types of Software Development in 2024 (6 minute read)

Whether you’re aspiring to become a developer or simply curious about the field, understanding the types of software development is fundamental.

Essential ES6 JavaScript Features Every JavaScript Developer Should Know (3 minute read)

As a developer, it's crucial to stay updated with recent technologies to remain relevant and...

Show me you can use an API

Use this repo and pick any API you’d like and create something with it.

Could be something beginner or advanced, have fun with it.

GitHub - public-apis/public-apis: A collective list of free APIs

A collective list of free APIs. Contribute to public-apis/public-apis development by creating an account on GitHub.

Examples to get started

  • Weather app (classic) Example API for it

  • Cat Fact Generator Example API for it

  • Gif generator Example API for it

How To Submit Answers

Reply with this:

  • A link to your solution (github, personal blog, portfolio, etc)

  • A link to your post on Twitter, Linkedin, or any social platform you use.

Just released another video😁

Just finished and released another video

Pretty much just me yapping about stuff, so the usual.

Check it out here:

If you subscribed to Sloth Bytes because of that video then uhhhh watch it again.

Besides that, I’m probably gonna start working on another coding project, we’ll see if that becomes a video too.

But that’s all from me!

Have a great week, be safe, make good choices, and have fun coding.

See you all next week.

Reply

Avatar

or to participate

Keep Reading

envelope-simple

Join 50k+ developers and become a better programmer and stay up to date in just 5 minutes.

© 2026 Sloth Bytes.
Report abusePrivacy policyTerms of use
beehiivPowered by beehiiv