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"
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.