Slide 1

Slide 1 text

API REALTALK @pengwynn wynn.fm

Slide 2

Slide 2 text

WYNNNETHERLAND

Slide 3

Slide 3 text

@pengwynn

Slide 4

Slide 4 text

@pengwynn

Slide 5

Slide 5 text

WYNN.FM

Slide 6

Slide 6 text

No content

Slide 7

Slide 7 text

No content

Slide 8

Slide 8 text

No content

Slide 9

Slide 9 text

No content

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

I write API wrappers.

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

API #REALTALK

Slide 15

Slide 15 text

API #REALTALK

Slide 16

Slide 16 text

HYPERMEDIA COMES WITH A TAX

Slide 17

Slide 17 text

HYPERMEDIA COMES WITH A TAX #REALTALK

Slide 18

Slide 18 text

YOUR API IS HYPOMEDIA

Slide 19

Slide 19 text

YOUR API IS HYPOMEDIA #REALTALK

Slide 20

Slide 20 text

DEMO

Slide 21

Slide 21 text

DEVELOPERS BUILD URLS

Slide 22

Slide 22 text

DEVELOPERS BUILD URLS [ EVEN WHEN YOU ASK THEM NOT TO ] #REALTALK

Slide 23

Slide 23 text

DEVELOPERS DON'T READ YOUR DOCS

Slide 24

Slide 24 text

DEVELOPERS DON'T READ YOUR DOCS #REALTALK

Slide 25

Slide 25 text

YOU'RE NOT DOGFOODING IT

Slide 26

Slide 26 text

YOU'RE NOT DOGFOODING IT #REALTALK

Slide 27

Slide 27 text

NATIVE APPS

Slide 28

Slide 28 text

BUILD SOMETHING MEANINGFUL WITH YOUR API.

Slide 29

Slide 29 text

Janky BUILD SOMETHING MEANINGFUL WITH YOUR API.

Slide 30

Slide 30 text

Janky Heaven BUILD SOMETHING MEANINGFUL WITH YOUR API.

Slide 31

Slide 31 text

Janky Heaven Monitors BUILD SOMETHING MEANINGFUL WITH YOUR API.

Slide 32

Slide 32 text

Janky Team Heaven Monitors BUILD SOMETHING MEANINGFUL WITH YOUR API.

Slide 33

Slide 33 text

Janky Team Hire Heaven Monitors BUILD SOMETHING MEANINGFUL WITH YOUR API.

Slide 34

Slide 34 text

Janky Team Hire Heaven Monitors Boxen BUILD SOMETHING MEANINGFUL WITH YOUR API.

Slide 35

Slide 35 text

Janky Team Hire Heaven Monitors Boxen Graph Store BUILD SOMETHING MEANINGFUL WITH YOUR API.

Slide 36

Slide 36 text

Janky Team Hire Heaven Monitors Boxen Graph Store BUILD SOMETHING MEANINGFUL WITH YOUR API. Haystack

Slide 37

Slide 37 text

API-POWERED WORKFLOW

Slide 38

Slide 38 text

No content

Slide 39

Slide 39 text

No content

Slide 40

Slide 40 text

No content

Slide 41

Slide 41 text

No content

Slide 42

Slide 42 text

No content

Slide 43

Slide 43 text

No content

Slide 44

Slide 44 text

No content

Slide 45

Slide 45 text

How GitHub uses the GitHub API.

Slide 46

Slide 46 text

AuthN How GitHub uses the GitHub API.

Slide 47

Slide 47 text

AuthN AuthZ How GitHub uses the GitHub API.

Slide 48

Slide 48 text

AuthN AuthZ Merging How GitHub uses the GitHub API.

Slide 49

Slide 49 text

AuthN AuthZ Merging Commit Status How GitHub uses the GitHub API.

Slide 50

Slide 50 text

AuthN AuthZ Merging Commit Status GFM How GitHub uses the GitHub API.

Slide 51

Slide 51 text

SOMETIMES FOLKS DON'T GET YOU.

Slide 52

Slide 52 text

SOMETIMES FOLKS DON'T GET YOU. #REALTALK

Slide 53

Slide 53 text

GET /me? HTTP/1.1 200 OK Server: example.com Content-Type: application/json; charset=utf-8 Connection: keep-alive Status: 200 OK

Slide 54

Slide 54 text

GET /me? HTTP/1.1 200 OK Server: example.com Content-Type: application/json; charset=utf-8 Connection: keep-alive Status: 200 OK Developer hears: :OK

Slide 55

Slide 55 text

GET /me? HTTP/1.1 200 OK Server: example.com Content-Type: application/json; charset=utf-8 Connection: keep-alive Status: 200 OK Developer hears: :OK

Slide 56

Slide 56 text

GET /me? HTTP/1.1 500 INTERNAL SERVER ERROR Server: example.com Content-Type: application/json; charset=utf-8 Connection: keep-alive Status: 500 INTERNAL SERVER ERROR

Slide 57

Slide 57 text

GET /me? HTTP/1.1 500 INTERNAL SERVER ERROR Server: example.com Content-Type: application/json; charset=utf-8 Connection: keep-alive Status: 500 INTERNAL SERVER ERROR Developer hears: :DOH

Slide 58

Slide 58 text

GET /me? HTTP/1.1 500 INTERNAL SERVER ERROR Server: example.com Content-Type: application/json; charset=utf-8 Connection: keep-alive Status: 500 INTERNAL SERVER ERROR Developer hears: :DOH

Slide 59

Slide 59 text

GET /me? HTTP/1.1 403 FORBIDDEN Server: example.com Content-Type: application/json; charset=utf-8 Connection: keep-alive Status: 403 FORBIDDEN

Slide 60

Slide 60 text

GET /me? HTTP/1.1 403 FORBIDDEN Server: example.com Content-Type: application/json; charset=utf-8 Connection: keep-alive Status: 403 FORBIDDEN Developer hears: :NOPE

Slide 61

Slide 61 text

GET /me? HTTP/1.1 302 FOUND Server: example.com Content-Type: application/json; charset=utf-8 Connection: keep-alive Status: 302 FOUND Location: https://example.com/over/there !

Slide 62

Slide 62 text

GET /me? HTTP/1.1 302 FOUND Server: example.com Content-Type: application/json; charset=utf-8 Connection: keep-alive Status: 302 FOUND Location: https://example.com/over/there Developer hears: :WAT

Slide 63

Slide 63 text

/302 me The requested resource resides temporarily under a different URI. Since the redirection might be altered on occasion, the client SHOULD continue to use the Request-URI for future requests. This response is only cacheable if indicated by a Cache- Control or Expires header field.

Slide 64

Slide 64 text

ETAGS ARE COOL. NOBODY USES 'EM.

Slide 65

Slide 65 text

ETAGS ARE COOL. NOBODY USES 'EM. #REALTALK

Slide 66

Slide 66 text

curl -I https://api.github.com/users/defunkt ! HTTP/1.1 200 OK Server: nginx Date: Wed, 12 Sep 2012 14:07:43 GMT Content-Type: application/json; charset=utf-8 Connection: keep-alive Status: 200 OK Content-Length: 692 X-Content-Type-Options: nosniff X-RateLimit-Remaining: 4997 X-RateLimit-Limit: 5000 Cache-Control: public, s-maxage=60, max-age=60 Vary: Accept X-GitHub-Media-Type: github.beta ETag: "ef742caec0c19e2169ffb05e7d200d17" Last-Modified: Tue, 11 Sep 2012 02:52:21 GMT

Slide 67

Slide 67 text

curl -I https://api.github.com/users/defunkt ! HTTP/1.1 200 OK Server: nginx Date: Wed, 12 Sep 2012 14:07:43 GMT Content-Type: application/json; charset=utf-8 Connection: keep-alive Status: 200 OK Content-Length: 692 X-Content-Type-Options: nosniff X-RateLimit-Remaining: 4997 X-RateLimit-Limit: 5000 Cache-Control: public, s-maxage=60, max-age=60 Vary: Accept X-GitHub-Media-Type: github.beta ETag: "ef742caec0c19e2169ffb05e7d200d17" Last-Modified: Tue, 11 Sep 2012 02:52:21 GMT Fingerprint

Slide 68

Slide 68 text

curl -I \ -H 'If-None-Match:"ef742caec0c19e2169ffb05e7d200d17" \ https://api.github.com/users/defunkt ! HTTP/1.1 304 Not Modified Server: nginx Date: Wed, 12 Sep 2012 15:51:39 GMT Connection: keep-alive Status: 304 Not Modified X-RateLimit-Limit: 5000 X-Content-Type-Options: nosniff Vary: Accept ETag: "ef742caec0c19e2169ffb05e7d200d17" X-RateLimit-Remaining: 4997 Last-Modified: Wed, 12 Sep 2012 01:38:14 GMT Cache-Control: public, s-maxage=60, max-age=60

Slide 69

Slide 69 text

$ curl -i https://api.github.com/user HTTP/1.1 200 OK Cache-Control: private, max-age=60 ETag: "644b5b0155e6404a9cc4bd9d8b1ae730" Last-Modified: Thu, 05 Jul 2012 15:31:30 GMT Status: 200 OK Vary: Accept, Authorization, Cookie X-RateLimit-Limit: 5000 X-RateLimit-Remaining: 4996 ! $ curl -i https://api.github.com/user -H "If-Modified-Since: Thu, 05 Jul 2012 15:31:30 GMT" ! HTTP/1.1 304 Not Modified Cache-Control: private, max-age=60 Last-Modified: Thu, 05 Jul 2012 15:31:30 GMT Status: 304 Not Modified Vary: Accept, Authorization, Cookie X-RateLimit-Limit: 5000 X-RateLimit-Remaining: 4996 ! $ curl -i https://api.github.com/user -H 'If-None-Match: "644b5b0155e6404a9cc4bd9d8b1ae730"' ! HTTP/1.1 304 Not Modified Cache-Control: private, max-age=60 ETag: "644b5b0155e6404a9cc4bd9d8b1ae730" Last-Modified: Thu, 05 Jul 2012 15:31:30 GMT Status: 304 Not Modified Vary: Accept, Authorization, Cookie X-RateLimit-Limit: 5000 X-RateLimit-Remaining: 4996

Slide 70

Slide 70 text

LAST-MODIFIED HEADERS FOR COLLECTIONS ARE HARD TO CALCULATE

Slide 71

Slide 71 text

LAST-MODIFIED HEADERS FOR COLLECTIONS ARE HARD TO CALCULATE #REALTALK

Slide 72

Slide 72 text

N+1 OVER HTTP IS EXPENSIVE, YO

Slide 73

Slide 73 text

N+1 OVER HTTP IS EXPENSIVE, YO #REALTALK

Slide 74

Slide 74 text

YOUR N+1 PROBLEM IS MY FAST LISTING

Slide 75

Slide 75 text

YOUR N+1 PROBLEM IS MY FAST LISTING #REALTALK

Slide 76

Slide 76 text

Attribution Hand designed by Naomi Atkinson from The Noun Project Cereal designed by Jacob Halton from The Noun Project Evil designed by Jim Lears from The Noun Project Console designed by Austin Andrews from The Noun Project Report designed by Doug Cavendish from The Noun Project Television designed by Piero Borgo from The Noun Project Person designed by Paulo Sá Ferreira from The Noun Project Detour designed by Dmitry Baranovskiy from The Noun Project Mime designed by Jonathan C. Dietrich from The Noun Project

Slide 77

Slide 77 text

Thanks.

Slide 78

Slide 78 text

Thanks. Feedback: github.com/pengwynn/pingwynn @pengwynn wynn.fm