Coldfusion Flickr JSON
Nov 28
Last weekday, I've read Flickr API developers section. As we all know, there is already CFlickr which support us to integrate CF and Flickr for uploading photos, retrieving photos and so on. But, I'm getting sick of installing this CFlickr in my blog because I only need to display my photography in my blog and don't want to upload and edit anymore.
To display Flickr in our blog, we can also use with RSS feed. If we use RSS feed by retrieving data from Flickr, Flickr will product small images. I've already posted about it in my blog already. Simple Flickr Integration But I don't like those small thumbnail. What I gonna do if I want to display medium thumbail? Answer is very simple. "Use Flickr API"
Usage of Flickr API
2<!---
3 I need to use this method.
4 Because it's only for display.
5--->
6method : flickr.photos.search
7<!---
8 There are 3 types of format.
9 1. REST (JSON)
10 2. XML-RPC
11 3. SOAP
12 But I only need to use JSON.
13 --->
14format : json
15<!---
16 I only retrieve data.
17 That's why nojsoncallback is 1 (Yes).
18--->
19nojsoncallback : 1
20<!--- Your API --->
21api_key : [YOUR_API_KEY]
22<!--- Your Flickr Account --->
23user_id : [YOUR_USER_ID]
Following coding is retrieving JSON data from Flickr with the parameters above I mention.
2 method = "get"
3 url = "http://api.flickr.com/services/rest/"
4 result = "msgJSON">
5 <cfhttpparam
6 type = "url"
7 name = "api_key"
8 value = "c50d9a9f05ce883871105b77ff98104c">
9 <cfhttpparam
10 type = "url"
11 name = "format"
12 value = "json">
13 <cfhttpparam
14 type = "url"
15 name = "nojsoncallback"
16 value = "1">
17 <cfhttpparam
18 type = "url"
19 name = "method"
20 value = "flickr.photos.search">
21 <cfhttpparam
22 type = "url"
23 name = "user_id"
24 value = "8856032@N06">
25</cfhttp>
After running above code, you will get the JSON data type from Flickr. But, we need to convert JSON data type into CFML data type with deserializeJSON.
And dump it.
You will finally get the following CF structure format.

Android
Top of Page