APIDaysBCN 2014

Once again I was lucky enough to attend an API Days event. This year the conference was in Barcelona. The scale of the event was noticeably increased compared to last year’s conference in Madrid. This time the venue was the Mobile World Centre in Plaza Catalunya, opposite the Bank of Spain. This in itself is perhaps an indication of the rapid evolution of the API industry.Mobile World Centre

This post is a reconstruction of my scribbles over the two days.

The API Scene

API principles

Notes from the Kin Lane, The API Evangelist.

Don’t invent the wheel – use familiar patterns. For example, an API describing a profile should consider something like /me used on Facebook.

Share API designs

Find APIs (an alternative to Programmble Web)

APIs and value chains from 3scale by Manfred

The Power of /me from Bruno Pedro. An overview of the battle between the online giants for ownership of user identities, with a quick dip into OAuth2

APIs that offer interesting Services

APIs for integrating online payments

APIs for sending emails

Examples of real-time APIs and webhooks

Twitter APIs from Romain Huet. The Twitter demo covered three topics

  1. Monitoring and filtering Tweets in real time from the Streaming APIs
  2. Tweeting pictures from a Raspberry Pi and its Camera Module
  3. Controlling a Parrot AR.Drone from Tweets and acknowledging commands

Source code from the demos is available here

Each topic is covered in more detail

Streaming is based on all the tweets, an average of ~500 million tweets per day exposed through Firehose.

Vigiglobe are using Twitter streams to analyse public opinion

Another example, the Brit Awards peaked at 78k tweets per minute. The endpoints are simple.

POST https://stream.twitter.com/1.1/statuses/filter.json
POST https://stream.twitter.com/1.1/statuses/sample.json
(links needs to be within an Authenticaton context)

The sample endpoint streams one percent of the entire Firehose. You need some serious infrastructure and commercials to consume the whole thing. The Twitter Streaming API uses long polling to hold a connection open. The Twitter recommendation is that stream consumers use a single client running on their network (something like Node.js) to harvest and filter tweets. The client would then use web sockets to push notifications out to website visitors.

Another cool thing is the Amazon integration with Twitter allows users to add items to their shopping cart through #AmazonBasket.

More information about become a certified Twitter partner

Here’s that photo taken by a tweeting Raspberry PI (I’m in there somewhere).

romainWithPi

Dropbox updates from Leah Culver

Dropbox have recently added support for datastores to their APIs. This turns a dropbox folder into a NoSQL database, located in the cloud.

The user account defines the quota. And here’s an example that uses datastore to hold game state and high scores

(2048 is a game that everyone is going crazy about .. apparently).

Other Stuff

Big data for free (as in beer)

Using Dremel an open source java implementation of Google Big Query and Redis is in there too.

Tools and Tips for API Designers

The wireshark of API sniffing (from 3scale who were conference sponsors by the way)

Slides from the conference

API design at Heroku from @brandur

Insightful review of the API design process undergone by Heroku. The APIs control access to the Heroku platform and prior to the release of v3 was extensively re-designed. The API is innovative through it’s use of JSON Schemas. Heroku have generously published the API guidelines that were developed as a result of the process.

Conference slides

Example of API that uses Hypermedia well (from Ori Pekelman)

In true Hypermedia style, this is the only published endpoint – everything else is through discovery

GET http://api.navitia.io/v1/
How to do Hypermedia well
How to do Hypermedia well

 

 

 

 

 

 

 

 

 

 

 

 

 

Example from Salesforce of a Mobile API using Angular

Optimistic API Design from Pau Ramon Revilla / Api designer @ redbooth.com

Use PATCH for partial updates

problem: two PUTs in a race condition but only one can win

PUT { "name":"Robert", "hiScore":"25", "id":"123" }
PUT { "name":"Bob", "hiScore":"35", "id":"123" }

because PUT requires the entire payload. PATCH allows a partial update.

PATCH { "hiScore":"25", "id":"123" }
PATCH { "hiScore":"35", "id":"123" }

More on PATCH. Use a 202 response for non-deterministic operations.

DELETE /things/1
202 # accepted for further process
 { "rel":"/things/1/AD234" }

… some time passes

GET /things/1/AD234
200 # deletion request processed

Ronnie Mitra from Layer 7 presented a tool for prototyping API designs. Using a drag-n-drop interface the tool allows an API designer to create API endpoints as “cells”. There is some automation for the process of creating dummy request / responses and also support for Hypermedia-style linking. Ronnie promised me that it will export to WADLs and other API specification formats.

Finally here’s a picture of the main man, KinLane.

kinLane

Leave a Reply

Your email address will not be published. Required fields are marked *