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

Post on 29-Nov-2014

145 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

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

TRANSCRIPT

#apistrat

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

WordPress aims to democratize publishing.

@nacin

@nacin

@nacin

@nacin

@nacin

@nacin

@nacin

@nacin

@nacin

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

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

@nacin

@nacin

@nacin

@nacin

@nacin

@nacin

@nacin

@nacin

@nacin

@nacin

@nacin

@nacin

@nacin

more than 60 million sites run WordPress

23.1 percent of the top 10 million sites run WordPress

— W3Techs, Sept. 25

ubiquity

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

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

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

The WordPress dashboard

Single page applications

Mobile apps

WordPress is increasingly used to build web apps

WordPress as a content management interface

Consuming published content and structured data

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

But now we need an API

But now we need an API

‘an API’

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

WordPress is a platform for content

WordPress is a platform for developers

WordPress is a platform for APIs

One in four sites run the same software.

Massive potential here.

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

our qualities

Flexibility

Be able to use the API to build cool stuff.

Performance

Efficiency, without real say in the server or environment.

Extensibility

Any plugin can change how the API works.

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

Discoverability

So, like, hypermedia, but in practice.

User Experience

OAuth app registration is the DMV of the internet.

Portability

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

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

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

Centrality

Can’t just deploy a bug fix.

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

Compatibility

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

Quality

We’re “flooding the market”

Responsibility

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

some of our solutions

OAuth 1a doesn’t need SSL.

Portability

?_method=PUT ?_method=DELETE

Portability

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

Centrality

JSON HAL for discoverability.

Discoverability

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

Interoperability

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

Portability

Maybe we can deploy bug fixes with auto updates.

Stability

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

Wired & The New York Times are already using it.

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

Responsibility

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

Is WordPress the next gateway drug for APIs?

@nacin nacin@wordpress.org

wp–api.org make.wordpress.org

top related