Search⌘ K
AI Features

Conventions for REST APIs

Explore how to design REST APIs using Flask by understanding resource naming conventions, HTTP methods like GET and POST, JSON data exchange, and the use of meaningful HTTP status codes. This lesson helps you build scalable, stateless server-side APIs following best practices.

The properties of REST APIs

The uniform interface property is achieved by abiding by certain API design conventions. These conventions require the designer to think in terms of resources (nouns) and actions (verbs). A simple example will illustrate the point.

Suppose we’re developing a card catalog. Each book has an author, a title, and an indication of whether it’s been lent out. Typically, we would construct two types of URIsA Uniform Resource Identifier is a unique sequence of characters that identifies a logical or physical resource used by web technologies, also called routes, from the server’s perspective. The first one refers to all books and might be website.com/books/.

The second type refers to a single book and might be website.com/books/9780385333788, where we’ve chosen to use the book’s ISBNInternational Standard Book Number, ISBNs are calculated using a specific mathematical formula and include a check digit to validate the number as its unique identifier. Notice ...