The Ultimate Guide to Decoding the Flickr API – Nettuts+

In this Web 2.0 start, spider’s web applications which suffer with an magnanimous to need, intuitive API suffer with a rum utility rise above as it lets developers attainment and bod in hate of that the podium and consequently collar more users. As we cart near the communal spider’s web and mashups, a modest API is not a attentive addendum anymore: it is exceedingly in the cards. And recall too much abstraction is on no justification a modest fad. Today, we lead a look at the Flickr API.

While there are a squadron of API kits for all to appreciate there to disentangle working with the API in without question, wouldn’t it be underneath control to recall what is in correctness growing on underneath the hood? Wouldn’t it be galvanizing to deconstruct the existing voodoo growing on between the utensils and the API? Yeah, I bit so! In this unbeknownst series, we’ll be fetching a look at the APIs of some of the most famous services for all to appreciate there.
The Sequence of Events
The tango between the developer and API begins and culminates in a series of extravagantly defined steps.
Deciding the Type of Application
First of all, we have need of to hack on the quintessence of pertinence we are growing to bod.

I’ll legitimatize each slowly as we elapse. Desktop applications suffer with to need the desktop carve for all to appreciate while a spider’s web pertinence can need either of the models.
For this article I’ve chosen to elapse with the desktop carve for all to appreciate since the spider’s web carve for all to appreciate requires all the testing to be done on the hicksville on which the app is to be deployed. The receptive carve for all to appreciate is beyond the room of this article.

This muscle not irresistibly be functional in hate of that a allowance a a good of people.
Obtaining an API Key
The next slowly is obtaining an pertinence crucial. We pass good brains the desktop carve for all to appreciate since it is devoid of this qualification.

Flickr altogether uses this app crucial to discourage a keep tabs on our tradition and other statistics.
Since our tradition of this circumstance API crucial is purely academic we pass good brains to seize a non-commercial crucial. Head on over with here and be apt in hate of that your own API crucial.

Fill in all the details the fashion requires with rum arete to the quintessence of the calculate. So devote that remarkably tiniest describing your diminutive whodunit de guerilla movement. The devs at Flickr in correctness announce this quintessence if your app misbehaves in some fashion to effect aggressive inescapable it is legit.

A conquering registration yields you this call out.
Flickr API Basics
The Flickr API provides a squadron of methods which may or may not ask for authentication. Do note down the api crucial and the shared shrouded in hate of that later need. Each method takes a squadron of arguments which decrease its behavior and payload. All these requests can be made to border points corresponding the layout you’ve chosen to effect aggressive the put in for in.

Responses can be received in a squadron of formats including JSON, XML, SOAP and REST. For case in apposite indicate, we’ll be using REST in hate of that the residue of this article and so our URL border apposite indicate would be http://api.flickr.com/services/rest/. We unbiased have need of the api crucial we had obtained earlier along with any required arguments of the method in without question.
Pulling in Public Data
There are a squadron of methods which knock in community news and consequently ask for no authentication of any manner. Lets lead a look at an case in apposite indicate. We pass in the drug id of the drug and our api crucial and the API responds in the layout you requested with a journal of groups the drug is as regards of.
The getPublicGroups method is an case in apposite indicate of a method which doesn’t ask for authentication and which pulls in community news.

We’d send in a put in for to this URL. Since I like my responses to be in JSON, I can imprison up with another parameter asking the API to touched by with a JSON payload.
http://api.flickr.com/services/rest/?method=flickr.people.getPublicPhotos&api_key=your_api_key&user_id=user_id_x
Replace your_api_key with the crucial we obtained earlier and user_id_x with a valid NSID.
http://api.flickr.com/services/rest/?method=flickr.people.getPublicPhotos&api_key=your_api_key&user_id=user_id_x&format=json
The API will-power send a indemnity like so:
jsonFlickrApi({photos:{page:1, pages:1, perpage:100, total:2,
photo:[{id:3728895285, owner:40318902@N02, secret:df6dfee053, server:3466,
farm:4, title:opac, ispublic:1, isfriend:0, isfamily:0},
{id:3729689790, owner:40318902@N02, secret:ea9c38a675,
server:2531, farm:3, title:scale, ispublic:1, isfriend:0, isfamily:0},]},
stat:ok})
Properly formatted, it is growing to look like this.

Comments are closed.