0% found this document useful (0 votes)
107 views20 pages

Designing Restful Web Apis: What Is Rest

This document provides an overview of designing RESTful web APIs. It discusses what REST is and how HTTP works using requests and responses. Key points of REST are separation of client and server, stateless requests, and a uniform interface. The document demonstrates HTTP requests and responses, showing the verb, headers, status codes, and content. It emphasizes designing pragmatic APIs that are productive while following REST principles and best practices. The next step will be designing a sample RESTful API as an example.

Uploaded by

Humberto Kira
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
107 views20 pages

Designing Restful Web Apis: What Is Rest

This document provides an overview of designing RESTful web APIs. It discusses what REST is and how HTTP works using requests and responses. Key points of REST are separation of client and server, stateless requests, and a uniform interface. The document demonstrates HTTP requests and responses, showing the verb, headers, status codes, and content. It emphasizes designing pragmatic APIs that are productive while following REST principles and best practices. The next step will be designing a sample RESTful API as an example.

Uploaded by

Humberto Kira
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

Designing RESTful Web APIs

WHAT IS REST

Shawn Wildermuth
MICROSOFT MVP, INSTRUCTOR AND FILMMAKER

@shawnwildermuth [Link]
Course
Overview What is this course?
- Helps you design Web APIs
- Agnostic to how implemented
- Understand REST’s role in APIs
- Introduce you to pragmatic design
What this course will teach you:
Course - How REST can be used to create APIs
Overview - Designing URI Endpoints
- Understand usage of verbs and nouns
- Why association APIs are important
- What role operational APIs take
- Why versioning APIs is so important
- To decide on securing your APIs
Course
Overview What you will need:
- Postman
• Operating System doesn’t matter

[Link]
Questions During the Course?
The History of Distributed APIs

Dawn of Object
Distributed Oriented Web-Based
Computing APIs APIs

Java
Queuing gRPC
RMI REST
Messaging CORBA GraphQL
XMLHTTP SOAP
RPC COM/
DCOM

2000

2020
2010
1990
1980
1970
Do You Really Need a Web API?
- Are you building a website?
- Are you building a Single Page App?
- Are you building a mobile app?
- If not, why are you doing it?
How Does HTTP Work?

POST
verb
Content Length: 11
headers
Stateless
content
Hello World

Request

Response

status
201code
headers
Content Type: text

content
Hello World
The Request Deconstructed
verb Action to perform on the server

headers • GET: Request Resource

• POST: Create Resource

• PUT: Update Resource

• PATCH: Update Partial Resource


content
• DELETE: Delete Resource

• More verbs…
The Request Deconstructed
verb Metadata about the request

headers • Content Type: The format of Content

• Content Length: Size of Content

• Authorization: Who’s making the call

• Accept: What type(s) can accept


content
• Cookies: Passenger data in the request

• More headers…
The Request Deconstructed
verb Content Concerning Request

headers • HTML, CSS, JavaScript, XML, JSON

• Content is not valid with some verbs

• Information to help fulfill request

• Binary and blobs common (e.g. .jpg)


content
The Response Deconstructed
status code Operation Status

headers • 100-199: Informational

• 200-299: Success

• 300-399: Redirection

• 400-499: Client Errors


content
• 500-599: Server Errors
The Response Deconstructed
verb Metadata about the response

headers • Content Type: The format of Content

• Content Length: Size of Content

• Expires: When to consider stale

• Cookies: Passenger data in the request


content
• More headers…
The Response Deconstructed
verb Content

headers • HTML, CSS, JavaScript, XML, JSON

• Binary and blobs common (e.g. .jpg)

• APIs often have their own types

content
Demo

HTTP in Action
REpresentational State Transfer*
- Concepts include:
• Separation of Client and Server
What is REST? • Server Requests are Stateless
• Cacheable Requests
• Uniform Interface

* Introduced by Roy Fielding's doctoral dissertation


Problems
- Too difficult to be qualified as "REST"

What is REST? - Dogma of REST vs. Pragmatism


• Structured architectural style
• The need to be productive
Demo

A Well Designed API


What We’ve Learned

HTTP is crucial to the way that APIs on the Web

Using REST is important, but be pragmatic about it

We’re designing a simple API to learn the basics


Next Up:
Designing a RESTful API

You might also like