O'Reilly logo

JavaScript Everywhere by Adam D. Scott

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 2. API Introduction

Picture yourself seated in a booth at a small, local restaurant where you’ve decided that you’d like to order a sandwich. The server writes your order on a slip of paper and passes that paper to the cook. The cook reads the order, takes individual ingredients to build the sandwich, and passes the sandwich to the server. The server then brings the sandwich to you to eat. If you decide, you’d then like some desert the process repeats.

An Application Programming Interface (API) is a set of specifications that allow one computer program to interact with another. A Web API works in much the same way that we ordered our sandwich. A client requests some data, that data travels to a web server application over the HyperTextTransfer Protocol (HTTP), the web server application takes the requests and processes data, the data is then sent to the client over HTTP.

In this chapter we’ll explore the broad topic of Web APIs and get started with our development by cloning the starter API project to our local machine. Before we do that, however, let’s explore the requirements of the application that we’ll be building.

What we’re building

Throughout the book we’ll be building a social note application, called Notedly. Users will be able to create an account, write notes in markdown, edit their notes, view a feed of other user’s notes, and “favorite” the notes of other users. In this portion of the book, we’ll be developing the API to support this application.

The requirements ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required