apis as the source of truth (zane claes)

21
Airbnb’s API: The Source-of-Truth COMMUNICATIONS INFRASTRUCTURE / ZANE CLAES

Upload: nordic-apis

Post on 09-Jan-2017

138 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: APIs as The Source of Truth (Zane Claes)

Airbnb’s API:The Source-of-Truth

COMMUNICATIONS INFRASTRUCTURE / ZANE CLAES

Page 2: APIs as The Source of Truth (Zane Claes)

Airbnb Mobile Evolution

(2011 - 2015)

Page 3: APIs as The Source of Truth (Zane Claes)
Page 4: APIs as The Source of Truth (Zane Claes)
Page 5: APIs as The Source of Truth (Zane Claes)
Page 6: APIs as The Source of Truth (Zane Claes)
Page 7: APIs as The Source of Truth (Zane Claes)

Ghosts of Airbnb Past

Or: How we Became API-Centric

Page 8: APIs as The Source of Truth (Zane Claes)

The Dangers of Hockey Sticks

Page 9: APIs as The Source of Truth (Zane Claes)

API v1(Ruby / Monorail)

Page 10: APIs as The Source of Truth (Zane Claes)

API v1 Web Controller

Page 11: APIs as The Source of Truth (Zane Claes)

• Duplicated Work: Web. Mobile Apps. MoWeb. Lantern. Etc.

• Inconsistent Behavior: Entirely different code paths. Payments on mobile, different than payments on web.

• Difficult to Scale: Direct data access prevents moving to Service-oriented Architecture. Monorail contains too many tables.

• Poor Security: Access enabled by default. Leaks PII. Difficult to have good security policy.

• No Type Safety: Crashes app, due to unpredictable types in returned fields.

• More Website Downtime: Due to cascading updates, and service entanglement.

Problems

Page 12: APIs as The Source of Truth (Zane Claes)

API v1 Web Controller

Page 13: APIs as The Source of Truth (Zane Claes)

Graphist(A Ruby Gem/Framework for Building APIs)

Page 14: APIs as The Source of Truth (Zane Claes)

• Code Reusability: Write once. Share with web, mobile, etc.

• Consistency: Everything works the same across platforms.

• Security: Security is at the forefront: do not leak sensitive data.

• Performance: Process more stuff, faster. API v2 is continuously improved and optimized.

• Scalability: Easier to move to Service-oriented Architecture. Free to change and improve underlying functionality.

• Better Debugging: Now you can actually debug.

Benefitsof API v2 (“Graphist”)

Page 15: APIs as The Source of Truth (Zane Claes)

• Hundreds of Developers• Thousands of Endpoints• Dozens of Services

Where it’s Used

Page 16: APIs as The Source of Truth (Zane Claes)

Graphist: Our Ruby Gem for APIs

(2016 and Beyond)

Page 17: APIs as The Source of Truth (Zane Claes)

Android

Javascript

iOS

Graphist

Ruby

HTTP

Inline

Services

Graphist is a DAO (“Data Access Object”)

Page 18: APIs as The Source of Truth (Zane Claes)

RESTor

GraphQL

REST and GraphQL are Interchangeable

Client Graphist

No need to change a single line of code.

Page 19: APIs as The Source of Truth (Zane Claes)

Client-CentricShifts the impetus of “formats” to the client; no more dev back-and-forth.

EfficientSolves over-fetching, under-fetching, even versioning; cross-platform tools.

CommunityReady-made developer tools: sandbox, documentation explorer.

FlexibleAllows for arbitrary functions, renamed attributes, and more.

Why GraphQL?

Leejay Abucayan
Double-click icon to show larger masked image, drag to position your desired icon within the image mask square.
Leejay Abucayan
Double-click icon to show larger masked image, drag to position your desired icon within the image mask square.
Leejay Abucayan
Double-click icon to show larger masked image, drag to position your desired icon within the image mask square.
Leejay Abucayan
Double-click icon to show larger masked image, drag to position your desired icon within the image mask square.
Page 20: APIs as The Source of Truth (Zane Claes)

Client

User ServiceClient

Listing Service

Review Service

Client

Microservice Distributed DAOs

Page 21: APIs as The Source of Truth (Zane Claes)

Questions?Want to Talk APIs?

[email protected]