Client-side Web APIs
  • About
  • Contact
  • FAQ

What are APIs

Application Programming Interfaces (APIs) are constructs made available in programming languages to allow developers to create complex functionality more easily. They abstract more complex code away from you, providing some easier syntax to use in its place.

When writing client-side JavaScript for web sites or applications, you won't go very far before you start to use APIs — interfaces for manipulating different aspects of the browser and operating system the site is running on, or even data from other web sites or services. In this module, we will explore what APIs are, and how to use some of the most common APIs you'll come across often in your development work. 

Resources

Web APIs

Overview

Communication APIs

The Network Information API provides information about the system's connection in terms of general connection type (e.g., 'wifi', 'cellular', etc.).

This can be used to select high definition content or low definition content based on the user's connection. The entire API consists of the addition of the NetworkInformation interface and a single property to the

Navigator interface: Navigator.connection.

RED GREEN BLUE

Resources

Communication APIs

Overview

Change Device Orientation.

camera

Resources

Hardware APIs

Overview

Storage APIs

Modern web browsers support a number of ways for web sites to store data on the user's computer — with the user's permission — then retrieve it when necessary. This lets you persist data for long-term storage, save sites or documents for offline use, retain user-specific settings for your site, and more. This article explains the very basics of how these work.

Local Storage Exercise

Anyone remembers MySpace? We were able to change the way our profiles looked. Change your profile picture and background color. Use local storage to save the image and color choice. Set the saved image and background color from the local storage when you refresh your page.

IndexedDB is a low-level API for client-side storage of significant amounts of structured data, including files/blobs. This API uses indexes to enable high-performance searches of this data.

    Exercise

    Grab images from the camera stream and save it to IndexedDB.

    Resources

    Client-side Storage APIs

    Overview

    Github