Slide 1

Slide 1 text

WARNING It’s about to get real in here! Be sure you have cURL installed! If you don’t, you can download it at: http://bit.ly/curl-download

Slide 2

Slide 2 text

HTTP and APIs

Slide 3

Slide 3 text

Who are you people?

Slide 4

Slide 4 text

Me!

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

I —

Slide 7

Slide 7 text

I — Web Development

Slide 8

Slide 8 text

I — Servers

Slide 9

Slide 9 text

I — Front-End Dev

Slide 10

Slide 10 text

I — Ruby

Slide 11

Slide 11 text

I — JavaScript

Slide 12

Slide 12 text

I — Starting Companies

Slide 13

Slide 13 text

I — Selling People Stuff

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

No content

Slide 16

Slide 16 text

What do you—?

Slide 17

Slide 17 text

What do you—? Come and Tell Me, Seriously!

Slide 18

Slide 18 text

Why sit and learn about HTTP for an hour and a half?

Slide 19

Slide 19 text

http://www.flickr.com/photos/sashawolff/3228711025/

Slide 20

Slide 20 text

The Server http://www.flickr.com/photos/sashawolff/3228711025/

Slide 21

Slide 21 text

The Server http://www.flickr.com/photos/sashawolff/3228711025/

Slide 22

Slide 22 text

The Server The Browser http://www.flickr.com/photos/sashawolff/3228711025/

Slide 23

Slide 23 text

The Server The Browser http://www.flickr.com/photos/sashawolff/3228711025/

Slide 24

Slide 24 text

HTTP The Server The Browser http://www.flickr.com/photos/sashawolff/3228711025/

Slide 25

Slide 25 text

HTTP The Server The Browser http://www.flickr.com/photos/sashawolff/3228711025/

Slide 26

Slide 26 text

I’m pedantic enough to be a little irritated by the common “Web vs Native” usage. They’re all Web apps, and this argument is really about client platforms; no more, no less. - Tim Bray http://www.tbray.org/ongoing/When/201x/2011/06/14/Native-vs-Web

Slide 27

Slide 27 text

HTTP is a four-letter word

Slide 28

Slide 28 text

$_GET and $_POST

Slide 29

Slide 29 text

I’m a web developer! http://www.flickr.com/photos/rodrigosa/5816634363/

Slide 30

Slide 30 text

http://www.flickr.com/photos/span112/2247470632/

Slide 31

Slide 31 text

http://www.flickr.com/photos/puuikibeach/24433366/

Slide 32

Slide 32 text

http://www.flickr.com/photos/puuikibeach/24433367/

Slide 33

Slide 33 text

The Most Common HTTP Request In The World

Slide 34

Slide 34 text

Anatomy of The Most Common HTTP Request In The World

Slide 35

Slide 35 text

> telnet google.com 80 Trying 74.125.67.147... Connected to google.com. Escape character is '^]'. GET / HTTP/1.1 Host: www.google.com

Slide 36

Slide 36 text

GET / HTTP/1.1 Host: www.google.com Method URI HTTP Version Headers

Slide 37

Slide 37 text

Request Methods

Slide 38

Slide 38 text

GET POST PUT DELETE OPTIONS PATCH CONNECT HEAD TRACE http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html

Slide 39

Slide 39 text

GET

Slide 40

Slide 40 text

POST

Slide 41

Slide 41 text

PUT

Slide 42

Slide 42 text

DELETE

Slide 43

Slide 43 text

Common Request Headers http://www.flickr.com/photos/alza06/3956562963/

Slide 44

Slide 44 text

Accept Host If-None-Match User-Agent If-Modified-Since Accept-Encoding Accept-Language Authorization Cookie Referer

Slide 45

Slide 45 text

Accept

Slide 46

Slide 46 text

Host

Slide 47

Slide 47 text

Referer

Slide 48

Slide 48 text

User-Agent

Slide 49

Slide 49 text

If-None-Match

Slide 50

Slide 50 text

If-Modified-Since

Slide 51

Slide 51 text

Cookie

Slide 52

Slide 52 text

Request Body

Slide 53

Slide 53 text

The Response http://www.flickr.com/photos/paulcross/5819125499/

Slide 54

Slide 54 text

HTTP/1.1 200 OK Date: Mon, 20 Jun 2011 01:31:09 GMT Expires: -1 Cache-Control: private, max-age=0 Content-Type: text/html; charset=ISO-8859-1 Set-Cookie: PREF=ID=e446d3d1e8716b64:FF=0:TM=1308533469:LM=1 8; expires=Wed, 19-Jun-2013 01:31:09 GMT; path=/ Set-Cookie: NID=48=LjvfA6B_EsbDM8pmkis7YdVijYG2RLCc78Ne0my9Q eSzuB6iCOkDOAl78_oEMugbXV2lD82hyLkeJhuY6-RiVZkRK 20-Dec-2011 01:31:09 GMT; path=/; domain=.google Server: gws X-XSS-Protection: 1; mode=block

Slide 55

Slide 55 text

Status Headers Body HTTP/1.1 200 OK Date: Mon, 20 Jun 2011 01:31:09 GMT Expires: -1 Cache-Control: private, max-age=0 Content-Type: text/html; charset=ISO-8859-1 Set-Cookie: PREF=ID=e446d3d1e8716b64:FF=0:TM=1308533469:LM=1 8; expires=Wed, 19-Jun-2013 01:31:09 GMT; path=/ Set-Cookie: NID=48=LjvfA6B_EsbDM8pmkis7YdVijYG2RLCc78Ne0my9Q eSzuB6iCOkDOAl78_oEMugbXV2lD82hyLkeJhuY6-RiVZkRK 20-Dec-2011 01:31:09 GMT; path=/; domain=.google Server: gws X-XSS-Protection: 1; mode=block

Slide 56

Slide 56 text

Response Status http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html 1xx Informational 2xx Successful 3xx Redirect 4xx Client Error 5xx Server Error

Slide 57

Slide 57 text

Response Headers Expires Set-Cookie Content-Length Connection Cache-Control ETag Content-Type Server Location WWW-Authenticate Date http://en.wikipedia.org/wiki/List_of_HTTP_headers

Slide 58

Slide 58 text

Date

Slide 59

Slide 59 text

Content-Type

Slide 60

Slide 60 text

Content-Length

Slide 61

Slide 61 text

Set-Cookie

Slide 62

Slide 62 text

Cache-Control

Slide 63

Slide 63 text

Expires

Slide 64

Slide 64 text

ETag

Slide 65

Slide 65 text

Response Body

Slide 66

Slide 66 text

Caching http://www.flickr.com/photos/epsos/5394616925/

Slide 67

Slide 67 text

Authentication

Slide 68

Slide 68 text

HTTP Problems

Slide 69

Slide 69 text

Let’s Build An API

Slide 70

Slide 70 text

SuperMegaWeatherData It’s like Wikipedia for Weather NASA

Slide 71

Slide 71 text

REST Represenational State Transfer

Slide 72

Slide 72 text

CRUD

Slide 73

Slide 73 text

C R U D DELETE PUT GET POST REATE EAD PDATE ELETE

Slide 74

Slide 74 text

Content Types

Slide 75

Slide 75 text

Authentication

Slide 76

Slide 76 text

Versioning http://www.flickr.com/photos/iboy/4290803434/

Slide 77

Slide 77 text

[email protected] @commondream