What is an API and how do we use them in web development?

What is an API and how do we use them in web development?

ยท

2 min read

Table of contents

No heading

No headings in the article.

What is an API?

An application programming interface (API) is code that sends instructions between one software platform to another.

APIs are meant get rid of complex code, and provide you with code that has easier syntax to use in its place.

Want an example?

Think of an electricity socket in your house.

If you want to power your computer, you wouldn't wire it directly into your electricity supply - you'd plug it into the electricity socket!

In this case, the socket serves as your "electricity" API.

What can APIs do in web applications?

๐Ÿ“„ Manipulate documents

๐Ÿ–ฅ๏ธ Fetch data from servers

๐Ÿ–Œ๏ธ Draw and manipulate graphics

๐Ÿ“น Play video and audio

๐Ÿ“ฑ Retrieve data from your device

๐Ÿ“ฆ Store data in your browser.

What types of APIs are there?

๐Ÿ“Œ Browser APIs

๐Ÿ“Œ 3rd Party APIs

Read the next texts to find out how they are different โคต๏ธ

๐Ÿ”— Browser APIs

โ†’ APIs that are built into your browser

โ†’ Immediately accessible in vanilla JavaScript

โญ Example: Geolocation API

You can find a list of browser APIs here: developer.mozila.org

๐Ÿ”— 3rd Party APIs

โ†’ APIs that are located on 3rd party servers

โ†’ Allow you to use part of those platform's functionality in your web applications

โญ Example: Twitter API

You can find a list of 3rd party APIs on @Rapid_API: rapidapi.com/hub

Want to build a small web application with an API? Here are some ideas to get you started:

๐Ÿ“Œ API Projects:

Quote Generator

Weather App

Meal Generator

Movie Database

Random User Generator

Flight Information App

GitHub User Search

ย