A Real Time Photo Stream with Flickr API

We are always looking for interesting use cases when it comes to streaming existing APIs, and providing a diverse range of example streams that you can use in your work. We’ve been focusing on market data, RSS feeds, and streaming social data using Twitter. Next, we wanted to look into the media sector and consider what the streaming opportunities were for images and photos. What better place to start than with the original photo API: the Flickr API.

The Flickr Photo Search API provides a wealth of dimensions you can use to dial in your photo stream, ranging from a plain text query to focusing in on a geographic region. Let’s start by looking at turning on a basic photo stream using Flickr API.

curl -v "https://streamdata.motwin.net/https://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=[your_api_key]&text=[text_search]&format=json&nojsoncallback=1&auth_token=[your_auth_token]&api_sig=[your_signature]&X-Sd-Token=MzhiNjExYzYtZTRlMC00N2JkLTk5ODItYjMxY2QwYjcyMmZj"

You’ll need to provide your own api key and authentication token and signature, take a look at Flickr’s authentication documentation if you need help. Next let’s look at how we can dial things in by location, and see how we can make our streams a little more meaningful.

You can filter in by location using place_id, which you can get via the the find places API (https://www.flickr.com/services/api/flickr.places.find.html):

curl -v "https://streamdata.motwin.net/https://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=[your_api_key]&place_id=[place_id]&format=json&nojsoncallback=1&auth_token=[your_auth_token]&api_sig=[your_signature]&X-Sd-Token=MzhiNjExYzYtZTRlMC00N2JkLTk5ODItYjMxY2QwYjcyMmZj"

Or, you can filter by latitude and longitude:

curl -v "https://streamdata.motwin.net/https://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=[your_api_key]&lat=[latitude]&lon=[longitude]&format=json&nojsoncallback=1&auth_token=[your_auth_token]&api_sig=[your_signature]&X-Sd-Token=MzhiNjExYzYtZTRlMC00N2JkLTk5ODItYjMxY2QwYjcyMmZj"

A Real Time Photo Stream with Flickr APIProviding some pretty interesting ways to tune into the photos that are being taken at a specific location, and turn them into a real time stream that could be published via website, or mobile application. When you have a platform as big as the Flickr platform, with so many people taking photos, you have the makings of a pretty interesting opportunity for delivering photo streams.

After the Flickr API, we’ll take a look at how we can do this same thing with Instagram. Creating topic or location based streams of photos using the existing Instagram web APIs. Showing what is possible when you take photos and images via existing APIs, and turn them into streams using Streamdata.io. Demonstrating the endless possibilities for real time streams, and event-driven notifications on top of API infrastructure that already exists.

A Modern API Toolbox

**Original source: streamdata.io blog

LEAVE A REPLY

Please enter your comment!
Please enter your name here