A Real-Time API for Next-Generation Apps

When we set out to create our API, we knew we had to support a basic set of interactions that developers would expect from a simple API.

At the end of the day, though, we really wanted to push our API to the next level to support a new kind of interaction around photos – one that supported the real-time nature of the content that people create on Instagram. So, we put in a bit of extra elbow grease, and today we’re launching an API with real-time update support.

So what exactly is Instagram’s Real-Time API?

As of today, developers will be able to tell the Instagram API that they’d like to subscribe to new photos from four different entities:

1) Users of the developer’s application: every time a user of an Instagram-linked application posts a photo, the developer’s application will receive a notification. Developers like Foodspotting and sites like Dropbox now both utilize this new functionality.

2) Tags: An application can track a given tag and receive updates every time a new photo is posted with a given tag.

3) Locations: Every time a new photo is geo-tagged with a specific location, the developer will receive a notification.

4) Geographies: Sometimes individual locations are too specific. For these cases, we suggest subscribing to Geographies. Geographies consist of a latitude and longitude and a radius. This allows developers to subscribe to a given area like Austin or a specific city block of Manhattan.

For an example we cooked up over this past couple days, take a look athttp://demo.instagram.com/

If you’re interested in having a look, we’ve open sourced the source code.

On this site, we’ve subscribed to 20 or so geographies of major cities around the world. This demo site gets a ping every time a photo is posted near that location with a geotag (note that only a small portion of our photos are geotagged today). If you’re in SF (or NYC) try posting a photo with a geo-tag and watch it pop up on the screen.

How does the real-time API work?

1) As a developer, you can sign up for the API athttp://instagram.com/developer/
2) You can then create a subscription using a simple command as outlined in the real-time section of the documentation
3) Every time there’s an update to a subscription, our servers POST an update your server using a simple web hook.
4) Your servers then query for the latest information.

These subscriptions and the new API enable three major enhancements to Instagram:

1) Universal Sharing on Any Service

We have a long list of sites that we’d like to integrate with – we knew we wanted to support more options, but the question was: how do we do it in a scalable, self-service way? We could have developers poll our servers every five minutes for every user of their application, but this quickly becomes inefficient and nearly impossible for large services.

Instead, a site like Foodspotting can have their users link up with the Instagram real-time API and instantly they’re receiving notifications of new photos taken by Foodspotting users. When the user uses the hashtag “#fs”, the picture is cross-posted on the user’s foodspotting account.

Also, an independent developer can decide that they really love a service, and would like to see better integration. Dropbox backup of Instagram photos is a pretty great example of this:http://instadrop.appspot.com/

Notice that the site doesn’t live with Instagram, nor does it live with Dropbox. A few hours can mean that a motivated developer can create new sharing options for Instagram on a whim. In fact, the Instadrop website is open-source, so any developer can take that code and create new sharing possibilities with ease. Check out the source code.

We’re excited to have both Foodspotting and Dropbox as consumers of the real-time API from day one.

2) Bringing Live to the Web

The real-time nature of the API means that developers that use next-gen servers like Tornado and Node.js can create live experiences to browse what’s happening on Instagram – and throughout the world. The demo site I mentioned above uses Node.js.

3) New browsing options

Today, Momento (one of the most popular personal apps) launches a new version of their app with full Instagram integration. Now Momento users can import their entire Instagram feed and browse posts day by day since their first photo.

Flipboard is one of the companies working with the Instagram API to explore beautiful new ways to view and interact with Instagram images. While we’re not quite ready to talk about it, all we can say is that it’s very cool, and we believe it’s a superlative experience for Instagram and Flipboard users.

About.me also has some really cool stuff up their sleeve – so expect to see full Instagram integration there as well in the coming week.

And finally, one of our favorite new sites is instagre.at which provides a super slick way to browse Instagram’s most popular photos.

2000 developers have already signed up for the private beta, and we’re excited to support a growing community of enthusiastic and creative engineers. Have a cool idea? Get started by reading the API documentation

And by the way, if you’re a talented engineer and think this is pretty cool stuff – we’re hiring! Send your resume to jobs@instagram.com

Kevin + The Instagram Team

Vía: instagr.am

Leave a Reply

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