Slide 1

Slide 1 text

APIs - and - The Interconnected Web

Slide 2

Slide 2 text

I’m Darcy.

Slide 3

Slide 3 text

sutto@sutto.net @sutto github.com/sutto

Slide 4

Slide 4 text

Filter Squad and we make apps as Discovr

Slide 5

Slide 5 text

I make and consume APIs.

Slide 6

Slide 6 text

If I talk too fast, yell “slow down”.

Slide 7

Slide 7 text

The Promise

Slide 8

Slide 8 text

“The Open Web”

Slide 9

Slide 9 text

... but not as you know it.

Slide 10

Slide 10 text

We’re still in a walled garden.

Slide 11

Slide 11 text

The Web is more than HTML, CSS and JavaScript.

Slide 12

Slide 12 text

The Web is a giant graph of data.

Slide 13

Slide 13 text

We’re not just talking about open standards.

Slide 14

Slide 14 text

Making data accessible.

Slide 15

Slide 15 text

Hack & Build upon the shoulders of giants.

Slide 16

Slide 16 text

The ability to make our own “web”.

Slide 17

Slide 17 text

And to share that web with others.

Slide 18

Slide 18 text

What is an API?

Slide 19

Slide 19 text

“An application programming interface (API) is a protocol intended to be used as an interface by software components to communicate with each other”

Slide 20

Slide 20 text

No content

Slide 21

Slide 21 text

Structured, Parseable Data.

Slide 22

Slide 22 text

No content

Slide 23

Slide 23 text

{ "id": "723723854", "name": "Darcy Laycock", "first_name": "Darcy", "last_name": "Laycock", "link": "https://www.facebook.com/darcy.laycock", "username": "darcy.laycock", "gender": "male", "locale": "en_GB" }

Slide 24

Slide 24 text

No content

Slide 25

Slide 25 text

{ "login": "Sutto", "id": 553, "avatar_url": "https://truncated-url-goes-here/", "gravatar_id": "72d5f419e4a520ff4fe452400eac83d4", "url": "https://api.github.com/users/Sutto", "html_url": "https://github.com/Sutto", "followers_url": "https://api.github.com/users/Sutto/followers", "following_url": "https://api.github.com/users/Sutto/following", "gists_url": "https://api.github.com/users/Sutto/gists{/gist_id}", "starred_url": "https://api.github.com/users/Sutto/starred{/owner}{/repo}", "subscriptions_url": "https://api.github.com/users/Sutto/subscriptions", "organizations_url": "https://api.github.com/users/Sutto/orgs", "repos_url": "https://api.github.com/users/Sutto/repos", "events_url": "https://api.github.com/users/Sutto/events{/privacy}", "received_events_url": "https://api.github.com/users/Sutto/received_events", "type": "User", "name": "Darcy Laycock", "company": "Filter Squad", "blog": "blog.ninjahideout.com", "location": "Perth, Western Australia", "email": "sutto+github@sutto.net", "hireable": false, "bio": null, "public_repos": 66, "followers": 210, "following": 209, "created_at": "2008-02-21T05:29:17Z", "updated_at": "2013-03-02T06:37:19Z", "public_gists": 112 }

Slide 26

Slide 26 text

Specifically for computer consumption.

Slide 27

Slide 27 text

An interface.

Slide 28

Slide 28 text

A promise.

Slide 29

Slide 29 text

The Web is not Web Sites.

Slide 30

Slide 30 text

The Web is HTTP.

Slide 31

Slide 31 text

Source: http://www.flickr.com/photos/girliemac/sets/72157628409467125

Slide 32

Slide 32 text

A Brief History of APIs.

Slide 33

Slide 33 text

HTTP

Slide 34

Slide 34 text

1991: HTTP 0.9

Slide 35

Slide 35 text

1996: HTTP 1.0

Slide 36

Slide 36 text

1997: HTTP 1.1

Slide 37

Slide 37 text

A stateless protocol.

Slide 38

Slide 38 text

Built for Hypertext.

Slide 39

Slide 39 text

WS -

Slide 40

Slide 40 text

WSDL

Slide 41

Slide 41 text

SOAP

Slide 42

Slide 42 text

We Love XML!

Slide 43

Slide 43 text

We Hate XML!

Slide 44

Slide 44 text

No content

Slide 45

Slide 45 text

Atom

Slide 46

Slide 46 text

Web 2.0

Slide 47

Slide 47 text

aka “The Rise of the API”

Slide 48

Slide 48 text

REST

Slide 49

Slide 49 text

representational state transfer

Slide 50

Slide 50 text

Roy Fielding

Slide 51

Slide 51 text

REST

Slide 52

Slide 52 text

“REST”

Slide 53

Slide 53 text

Hypermedia!

Slide 54

Slide 54 text

Rich Internet Applications

Slide 55

Slide 55 text

No content

Slide 56

Slide 56 text

The Age of the App.

Slide 57

Slide 57 text

No content

Slide 58

Slide 58 text

No content

Slide 59

Slide 59 text

70% of what I do on my phone every day relies on an API.

Slide 60

Slide 60 text

APIs for...

Slide 61

Slide 61 text

No content

Slide 62

Slide 62 text

Single Page Apps

Slide 63

Slide 63 text

Companies building tools for building APIs.

Slide 64

Slide 64 text

Why APIs Matter

Slide 65

Slide 65 text

Estimated 2,400,000,000+ on the internet. (http://www.internetworldstats.com/stats.htm)

Slide 66

Slide 66 text

Estimated 1,000,000,000+ smart phones in use. (http://bit.ly/eotw13-api-smartphone)

Slide 67

Slide 67 text

Facebook http://developers.facebook.com/

Slide 68

Slide 68 text

http://graph.facebook.com/quairading

Slide 69

Slide 69 text

Google Geocoding http://bit.ly/eotw13-api-geocoding

Slide 70

Slide 70 text

No content

Slide 71

Slide 71 text

Twilio http://twilio.com/

Slide 72

Slide 72 text

Source: http://www.twilio.com/voice

Slide 73

Slide 73 text

Amazon Web Services http://aws.amazon.com

Slide 74

Slide 74 text

No content

Slide 75

Slide 75 text

SoundCloud http://developers.soundcloud.com

Slide 76

Slide 76 text

No content

Slide 77

Slide 77 text

Tesla Model S API http://bit.ly/eotw13-api-tesla

Slide 78

Slide 78 text

No content

Slide 79

Slide 79 text

No content

Slide 80

Slide 80 text

AirPlay http://nto.github.com/AirPlay.html

Slide 81

Slide 81 text

Source: http://www.flickr.com/photos/istig/5749756038/

Slide 82

Slide 82 text

Perth Transit http://doc.perthtransit.com

Slide 83

Slide 83 text

No content

Slide 84

Slide 84 text

IFTTT http://iftt.com

Slide 85

Slide 85 text

No content

Slide 86

Slide 86 text

How to make developers love you.

Slide 87

Slide 87 text

Because good just isn’t enough.

Slide 88

Slide 88 text

K.I.S.S.

Slide 89

Slide 89 text

Do just enough.

Slide 90

Slide 90 text

Treat your API as a communication medium.

Slide 91

Slide 91 text

Model it on languages.

Slide 92

Slide 92 text

Nouns are objects your API can expose.

Slide 93

Slide 93 text

Verbs are things you can do to APIs.

Slide 94

Slide 94 text

Adjectives are metadata.

Slide 95

Slide 95 text

Think in Object Graphs.

Slide 96

Slide 96 text

Be pragmatic.

Slide 97

Slide 97 text

Be consistent.

Slide 98

Slide 98 text

Make it easy to debug.

Slide 99

Slide 99 text

apiary.io

Slide 100

Slide 100 text

No content

Slide 101

Slide 101 text

Start with JSON.

Slide 102

Slide 102 text

Design for JSON.

Slide 103

Slide 103 text

Build out as needed.

Slide 104

Slide 104 text

Don’t reinvent auth.

Slide 105

Slide 105 text

No content

Slide 106

Slide 106 text

Always version your API.

Slide 107

Slide 107 text

It means you won’t break promises changing things.

Slide 108

Slide 108 text

Header based vs Path based.

Slide 109

Slide 109 text

/v1/ or /1/ at the start of the url.

Slide 110

Slide 110 text

Understand HTTP.

Slide 111

Slide 111 text

Incredibly simple!* * for varying definitions of simple.

Slide 112

Slide 112 text

Request / Response

Slide 113

Slide 113 text

GET POST HEAD

Slide 114

Slide 114 text

PUT DELETE TRACE CONNECT OPTIONS

Slide 115

Slide 115 text

PATCH LINK UNLINK

Slide 116

Slide 116 text

Status Codes

Slide 117

Slide 117 text

200 201 404 403 422

Slide 118

Slide 118 text

Headers!

Slide 119

Slide 119 text

X-Something-Huh: yes

Slide 120

Slide 120 text

Client Server Gateway

Slide 121

Slide 121 text

Caching!

Slide 122

Slide 122 text

ETags vs Cache-Control

Slide 123

Slide 123 text

Source: http://www.flickr.com/photos/samuraislice/3318411982/

Slide 124

Slide 124 text

Documentation is critical.

Slide 125

Slide 125 text

http://developer.github.com/v3/users/

Slide 126

Slide 126 text

Easy to read docs == Hard to write docs.

Slide 127

Slide 127 text

Explain things.

Slide 128

Slide 128 text

Explain how to use it.

Slide 129

Slide 129 text

No content

Slide 130

Slide 130 text

If it takes me a day to see results, I’ll just give up.

Slide 131

Slide 131 text

The browser is just another client.

Slide 132

Slide 132 text

No content

Slide 133

Slide 133 text

Hypermedia

Slide 134

Slide 134 text

No content

Slide 135

Slide 135 text

Similar in design to the web itself.

Slide 136

Slide 136 text

HTTP is about Hypermedia.

Slide 137

Slide 137 text

HTTP is about Hypermedia.

Slide 138

Slide 138 text

HATEOS

Slide 139

Slide 139 text

Hypermedia as the Engine of Application State.

Slide 140

Slide 140 text

Similar in spirit to REST as in Roy Fielding’s thesis.

Slide 141

Slide 141 text

Self Evident.

Slide 142

Slide 142 text

Discoverable.

Slide 143

Slide 143 text

Consistent.

Slide 144

Slide 144 text

JSON-HAL http://stateless.co/hal_specification.html

Slide 145

Slide 145 text

Collection+JSON http://bit.ly/eotw13-api-cjson

Slide 146

Slide 146 text

Tends to simplify API design.

Slide 147

Slide 147 text

Practical Concerns.

Slide 148

Slide 148 text

In closing

Slide 149

Slide 149 text

APIs are everywhere.

Slide 150

Slide 150 text

APIs power the web.

Slide 151

Slide 151 text

APIs help make the hard, easy.

Slide 152

Slide 152 text

Good APIs need consistency.

Slide 153

Slide 153 text

Don’t just build APIs.

Slide 154

Slide 154 text

Build APIs people love.

Slide 155

Slide 155 text

Learn HTTP

Slide 156

Slide 156 text

Live HTTP

Slide 157

Slide 157 text

Love HTTP

Slide 158

Slide 158 text

Embrace Data.

Slide 159

Slide 159 text

Share Data.

Slide 160

Slide 160 text

Care about making good APIs

Slide 161

Slide 161 text

Because you can make good APIs.

Slide 162

Slide 162 text

Because you can design great APIs.

Slide 163

Slide 163 text

Because the web is more than just HTML, CSS and JS.

Slide 164

Slide 164 text

No content

Slide 165

Slide 165 text

Thanks! http://developer.github.com http://apiary.io http://www.apigee.com http://soundcloud.com http://twilio.com http://developers.soundcloud.com http://www.designinghypermediaapis.com http://apigee.com/about/content/web-api-design http://speakerdeck.com/sutto