challenges building the wordpress rest api (api strategy & practice, chicago 2014)

89
#apistrat

Upload: andrewnacin

Post on 29-Nov-2014

145 views

Category:

Technology


1 download

DESCRIPTION

Building an API for everyone is about as hard as it sounds. Video: https://www.youtube.com/watch?v=DwHjiIrQlcg

TRANSCRIPT

Page 1: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

#apistrat

Page 2: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

Hi, I’m @nacin, a lead developer of WordPress.

Page 3: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

WordPress aims to democratize publishing.

Page 4: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)
Page 5: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

@nacin

Page 6: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

@nacin

Page 7: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

@nacin

Page 8: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

@nacin

Page 9: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

@nacin

Page 10: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

@nacin

Page 11: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

@nacin

Page 12: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

@nacin

Page 13: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

@nacin

Page 14: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

Top U.S. Newspapers by Print Circulation

1. The Wall Street Journal 2. The New York Times 3. USA Today 4. Los Angeles Times 5. New York Daily News 6. New York Post 7. The Washington Post 8. Chicago Sun-Times 9. The Denver Post

10. Chicago Tribune

Page 15: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

Top U.S. Newspapers by Print Circulation

1. The Wall Street Journal 2. The New York Times 3. USA Today 4. Los Angeles Times 5. New York Daily News 6. New York Post 7. The Washington Post 8. Chicago Sun-Times 9. The Denver Post

10. Chicago Tribune

Page 16: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

@nacin

Page 17: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

@nacin

Page 18: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

@nacin

Page 19: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

@nacin

Page 20: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

@nacin

Page 21: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

@nacin

Page 22: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

@nacin

Page 23: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

@nacin

Page 24: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

@nacin

Page 25: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

@nacin

Page 26: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

@nacin

Page 27: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

@nacin

Page 28: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

@nacin

Page 29: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

more than 60 million sites run WordPress

Page 30: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

23.1 percent of the top 10 million sites run WordPress

— W3Techs, Sept. 25

Page 31: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

ubiquity

Page 32: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

Everyone loves to hate on PHP, but it’s everywhere, and that’s what we like.

Page 33: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

We’re backwards compatible even across major releases, which means we’re stuck with anything we do.

Page 34: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

The most difficult aspect of our job is building the best experience for users.

Page 35: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

The WordPress dashboard

Page 36: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

Single page applications

Page 37: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

Mobile apps

Page 38: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

WordPress is increasingly used to build web apps

Page 39: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

WordPress as a content management interface

Page 40: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

Consuming published content and structured data

Page 41: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

We’re more than 12 years late on the ‘API first’ thing.

Page 42: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

But now we need an API

Page 43: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

But now we need an API

Page 44: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

‘an API’

Page 45: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

It’s not an API. It’s a distributed platform for serving extensible APIs.

Page 46: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

WordPress is a platform for content

Page 47: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

WordPress is a platform for developers

Page 48: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

WordPress is a platform for APIs

Page 49: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

One in four sites run the same software.

Massive potential here.

Page 50: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

Building an API for everyone is about as hard as it sounds.

Page 51: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

our qualities

Page 52: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

Flexibility

Page 53: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

Be able to use the API to build cool stuff.

Page 54: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

Performance

Page 55: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

Efficiency, without real say in the server or environment.

Page 56: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

Extensibility

Page 57: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

Any plugin can change how the API works.

Page 58: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

New content types, new relationships, new things to discover …

Page 59: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

Discoverability

Page 60: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

So, like, hypermedia, but in practice.

Page 61: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

User Experience

Page 62: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

OAuth app registration is the DMV of the internet.

Page 63: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

Portability

Page 64: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

Every site is its own little house on its own crappy shared hosting island.

Page 65: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

Can’t rely on SSL, which means no OAuth 2.

Page 66: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

Can’t even rely on the server to understand HTTP verbs.

Page 67: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

Centrality

Page 68: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

Can’t just deploy a bug fix.

Page 69: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

Each site is its own API, its own URL, its own version, its own plugins.

Page 70: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

Compatibility

Page 71: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

Different sites could run different versions, to say nothing of plugins.

Page 72: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

Quality

Page 73: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

We’re “flooding the market”

Page 74: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

Responsibility

Page 75: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

With great scale comes with great responsibility to not screw it up for everyone.

Page 76: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

some of our solutions

Page 77: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

OAuth 1a doesn’t need SSL.

Portability

Page 78: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

?_method=PUT ?_method=DELETE

Portability

Page 79: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

Pass-thru API URLs on WordPress.com, WordPress.org?

Centrality

Page 80: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

JSON HAL for discoverability.

Discoverability

Page 81: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

Official client libraries - work around pain points - graceful compatibility - ensures discoverability

Interoperability

Page 82: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

Plugins have their own namespace, with their own version. 1.0/posts my-plugin/2.0/books

Portability

Page 83: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

Maybe we can deploy bug fixes with auto updates.

Stability

Page 84: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

We are taking the time to do this right.

The plugin is version 1.0 and will always be backwards compatible. You can use it now and give feedback.

Quality

Page 85: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

Wired & The New York Times are already using it.

Page 86: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

If we do this right, we can help make APIs more mainstream.

Responsibility

Page 87: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

WordPress has been a gateway drug for many thousands of web developers.

Page 88: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

Is WordPress the next gateway drug for APIs?

Page 89: Challenges Building the WordPress REST API (API Strategy & Practice, Chicago 2014)

@nacin [email protected]

wp–api.org make.wordpress.org