<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Chris Herring &#187; api</title>
	<atom:link href="http://blog.chrisherring.co.uk/tag/api/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.chrisherring.co.uk</link>
	<description>Interaction, development and everything in between...</description>
	<lastBuildDate>Sun, 16 May 2010 16:30:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Faceflash Facebook</title>
		<link>http://blog.chrisherring.co.uk/2009/07/28/faceflash-facebook/</link>
		<comments>http://blog.chrisherring.co.uk/2009/07/28/faceflash-facebook/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 13:04:35 +0000</pubDate>
		<dc:creator>blog.chrisherring.co.uk</dc:creator>
				<category><![CDATA[Experiments]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[facebook]]></category>

		<guid isPermaLink="false">http://blog.chrisherring.co.uk/?p=524</guid>
		<description><![CDATA[So Adobe and Facebook came together a few months ago and released a full blown API for Flash/Actionscript 3, well released maybe more re-branded an existing API  by Jason Crist. Anyway the API is very detailed, and as far as I aware well documented. Thought after a few weeks it&#8217;s probably worth looking into, [...]]]></description>
			<content:encoded><![CDATA[<p>So Adobe and Facebook came together a few months ago and released a full blown API for <a href="http://www.adobe.com/devnet/facebook/" target="_blank">Flash/Actionscript 3</a>, well released maybe more re-branded an existing API  by <a href="http://pbking.com/blog/" target="_blank">Jason Crist</a>. Anyway the API is very detailed, and as far as I aware well <a href="http://facebook-actionscript-api.googlecode.com/svn/release/current/docs/index.html" target="_blank">documented</a>. Thought after a few weeks it&#8217;s probably worth looking into, as Facebook is still a buzzword which still holds a lot of weight.</p>
<p>In my opinion there are two types of application which will use the Facebook Flash API, the first being get and display apps. These are applications which get a users data and display information, think of the Last FM widget which display your top songs. Secondly an applications which take advantage of Facebook&#8217;s networking ability like Connect Red Bull. No doubt there are probably more types of application but there&#8217;s nothing like making a wide sweeping statement!</p>
<p style="margin-left:15px;"><img class="center" title="Facebook Preview" src="http://blog.chrisherring.co.uk/wp-content/uploads/images/facebook_noflash.jpg" alt="" width="550" height="390" /></p>
<p>Anyway I&#8217;m just going mention a couple of things, about this little get and display application I&#8217;ve quickly made which gathers list of the users friends and displays specific information. Below I have briefly listed the various steps in the process to get this information, as you can see the process is unlike other API&#8217;s which after making a call send you back an xml document of information. For instance twitter will give a xml document containing all your friends information. Instead with the Facebook API you make request for a friends list, get a list of unique id&#8217;s in return and then have to make individual user queries on the unique id&#8217;s. I imagine I&#8217;ve completely missed something here, but I may be right if this is the case it&#8217;s probably due to the scale of Facebook, the data available and the potentially security risk. Making individual user queries also means the amount of being data requested is smaller i.e you receive only what ask for.</p>
<p>&nbsp; &nbsp;1. User logins into Facebook<br />
&nbsp; &nbsp;2. User confirms login<br />
&nbsp; &nbsp;3. Start Facebook session<br />
&nbsp; &nbsp;4. Fetch users friends with users unique id<br />
&nbsp; &nbsp;5. Receive  unique id of users friends<br />
&nbsp; &nbsp;6. Fetch specific data for each of the users friends<br />
&nbsp; &nbsp;7. Receive data for each of the users friends<br />
&nbsp; &nbsp;8. Repeat 6 and 7 till complete<br />
&nbsp; &nbsp;9. Do whatever.</p>
<p>The little application I&#8217;ve produced, just displays a selected number of the Facebook user friends and some basic information name, picture, DOB, about me. Perhaps next time I&#8217;ll try some networking and add some error handling. Here&#8217;s the application.</p>
<p id="Facebook" style="margin-left:15px;">Flash is displayed here</p>
<p><script src="http://blog.chrisherring.co.uk/wp-content/js/swfobject.js" type="text/javascript"></script> <script type="text/javascript"><!--
var s4 = new SWFObject('http://blog.chrisherring.co.uk/wp-content/experiments/facebook/swf/facebook_board.swf','player','550','390','9');
s4.addVariable("basePath", "http://blog.chrisherring.co.uk/wp-content/experiments/facebook/")
s4.write('Facebook');
// --></script></p>
<p>And now some actionscript code.</p>
<p>By this stage the user has initialized the Facebook session by logging into Facebook, then confirmed they have done so and I have Completed a FriendList Request. Below I&#8217;m pushing all the unique id&#8217;s into an array, so they&#8217;re slightly more accessible then shuffling the array so I have a random order of friends each time.<br />
<code><br />
private function getFriendsInfoResponse(event:FacebookEvent):void<br />
{<br />
    event.target.removeEventListener(FacebookEvent.COMPLETE, this.getFriendsInfoResponse);</p>
<p>    var responseData:GetFriendsData = event.data as GetFriendsData;</p>
<p>    for(var i:Number = 0; i<responseData.friends.length; i++)<br />
    {<br />
       this.uniIdArray.push(responseData.friends.getItemAt(i).uid);<br />
    }</p>
<p>    ArrayShuffle.shuffle(this.uniIdArray);<br />
    this.loadFriend();<br />
}<br />
</code></p>
<p>Simple load request of a user's data by via a unique id.</p>
<p><code><br />
private function loadFriend():void<br />
{<br />
    var call:FacebookCall = facebook.post(new GetInfo([this.uniIdArray[this.loadCount]], ['uid', first_name',   'last_name',    'pic_small',  'about_me', 'birthday']));<br />
    call.addEventListener(FacebookEvent.COMPLETE, this.getFriendInfoResponse);<br />
}<br />
</code></p>
<p>I've created an ProfileObject class, which consists of various getters and setters for the requested data. And I know I've declared variables halfway into a function, but the first few lines handle errors. </p>
<p><code><br />
private function getFriendInfoResponse(event:FacebookEvent):void<br />
{<br />
    event.target.removeEventListener(FacebookEvent.COMPLETE, this.getFriendInfoResponse);</p>
<p>    if (!responseData || event.error)<br />
    {<br />
        trace("error ::" + this.loadCount);<br />
	this.loadFriend();<br />
	return;<br />
    }	</p>
<p>    var responseData:GetInfoData = event.data as GetInfoData;<br />
    var profileObj:ProfileObject = new ProfileObject();</p>
<p>    profileObj.uid = responseData.userCollection.getItemAt(0).uid;<br />
    profileObj.firstName = responseData.userCollection.getItemAt(0).first_name;<br />
    profileObj.lastName = responseData.userCollection.getItemAt(0).last_name;<br />
    profileObj.profilePic = responseData.userCollection.getItemAt(0).pic_small;<br />
    profileObj.aboutMe = responseData.userCollection.getItemAt(0).about_me;<br />
    profileObj.brithday = responseData.userCollection.getItemAt(0).birthday;<br />
    this.profileArray.push(profileObj);<br />
}<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.chrisherring.co.uk/2009/07/28/faceflash-facebook/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mapping Music: Part 2</title>
		<link>http://blog.chrisherring.co.uk/2009/01/16/mapping-music-part-2/</link>
		<comments>http://blog.chrisherring.co.uk/2009/01/16/mapping-music-part-2/#comments</comments>
		<pubDate>Fri, 16 Jan 2009 11:24:18 +0000</pubDate>
		<dc:creator>blog.chrisherring.co.uk</dc:creator>
				<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[lastfm]]></category>
		<category><![CDATA[mapping music]]></category>
		<category><![CDATA[maps]]></category>

		<guid isPermaLink="false">http://blog.chrisherring.co.uk/?p=151</guid>
		<description><![CDATA[After getting slightly distracted with the makeover I gave this blog last week and getting stuck into other work this week, I managed to spend a few hours this morning working on my Google Maps and Last FM mashup. Not to much to report, although I did managed to calculate a chart for the most [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">After getting slightly distracted with the makeover I gave this blog last week and getting stuck into other work this week, I managed to spend a few hours this morning working on my Google Maps and Last FM mashup. Not to much to report, although I did managed to calculate a chart for the most popular artist across Europe. Initially I was slightly disappointed with the figures perhaps I was expecting plays in the millions. After some calculator consultation the total number of top ten plays at 3mins estimates at 2.53 years worth of music. Impressive. </p>
<p>One issue that has risen is the high number of requests made to the Last FM api in order to get the country specific data. The choice was between using the  27 European Unions member states, or  the 49 countries which exist geographically within Europe. For the moment I&#8217;ve gone with the later, and ignored the 1.4mb of requests needed to complete this, but due to the Last FM api there is no other way of fetching the relevant data. A consequence of this is that Europe looks far more busy and the chart below is more populated. </p>
<p><img class="aligncenter" src="http://blog.chrisherring.co.uk/wp-content/uploads/images/mapping_music_3.jpg" alt="" width="580" height="356" /></p>
<p style="text-align: left; "><span style="text-decoration: underline;"><a title="Mapping maps example" href="http://blog.chrisherring.co.uk/experiments/mappingmusic/part_2/index.html" target="_blank"><img class="aligncenter" title="Mapping Music" src="http://blog.chrisherring.co.uk/wp-content/uploads/images/mapping_music_2.jpg" alt="" width="580" height="356" /></a></span></p>
<p style="text-align: left; ">The above image shows the chart generated after each of the European Countries data has been collated. I was slightly frustrated that the feed from the <a href="http://www.last.fm/api/show?service=297" target="_blank">Last FM api</a> isn&#8217;t live or updated on daily basis, instead I believe its updated weekly. I have uploaded the above build of Mapping Music and can be viewed <a title="Mapping music example" href="http://blog.chrisherring.co.uk/experiments/mappingmusic/part_2/index.html" target="_blank">here</a>. </p>
<p><strong>Next<br />
<span style="font-weight: normal;">- Individual country charts<br />
- Comparison charts<br />
- Improve the interface<br />
- Look into a chart timeline.</span></strong></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.chrisherring.co.uk/2009/01/16/mapping-music-part-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mapping Music: Part 1</title>
		<link>http://blog.chrisherring.co.uk/2009/01/05/mapping-music-part-1/</link>
		<comments>http://blog.chrisherring.co.uk/2009/01/05/mapping-music-part-1/#comments</comments>
		<pubDate>Mon, 05 Jan 2009 19:59:23 +0000</pubDate>
		<dc:creator>blog.chrisherring.co.uk</dc:creator>
				<category><![CDATA[Experiments]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[lastfm]]></category>
		<category><![CDATA[mapping music]]></category>
		<category><![CDATA[maps]]></category>

		<guid isPermaLink="false">http://blog.chrisherring.co.uk/?p=107</guid>
		<description><![CDATA[Mapping music is the title of a little project I started over the weekend, hopefully over the forthcoming days I shall be blogging on its development. The idea is to use information gathered via Last FM and the visualize this geographically for Europe using the Google Maps API for flash. In doing so I&#8217;ll try [...]]]></description>
			<content:encoded><![CDATA[<p>Mapping music is the title of a little project I started over the weekend, hopefully over the forthcoming days I shall be blogging on its development. The idea is to use information gathered via Last FM and the visualize this geographically for Europe using the <a href="http://code.google.com/apis/maps/documentation/flash/" target="_blank">Google Maps API</a> for flash. In doing so I&#8217;ll try to calculate the most popular artists across Europe and have fun learning something new. </p>
<p><strong>Structure </strong><br />
At the moment I have an xml file which contains a list of countries within the Europe, then for each country I have attributed a latitude and longitude value. This is represented in the image below with a blue dot. It is easy to notice some of the dots are not in the centre of the countries, a by product of <a title="http://www.batchgeocode.com/" href="http://" target="_blank">Batch Geocoder</a> which is rather good. </p>
<p>In order to collate the information from Last FM various API requests are made relating to each Country. On the edge of the image below, I have quickly displayed each Country and its most popular artist. </p>
<p><img class="aligncenter" title="mapping music" src="http://blog.chrisherring.co.uk/wp-content/uploads/images/mapping_music_1.jpg" alt="" width="480" height="296" /></p>
<p><strong>Next</strong><br />
- Add an interface of some sort<br />
- Figure out the most popular artist in Europe.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.chrisherring.co.uk/2009/01/05/mapping-music-part-1/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Tweet tweet flick!</title>
		<link>http://blog.chrisherring.co.uk/2008/12/07/83/</link>
		<comments>http://blog.chrisherring.co.uk/2008/12/07/83/#comments</comments>
		<pubDate>Sun, 07 Dec 2008 20:09:35 +0000</pubDate>
		<dc:creator>blog.chrisherring.co.uk</dc:creator>
				<category><![CDATA[Experiments]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[chrisherring.co.uk]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flickr]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://blog.chrisherring.co.uk/?p=83</guid>
		<description><![CDATA[I&#8217;ve just added a little twitter ticker flickr thing on chrisherring.co.uk which looks at my Twitter posts and fetches related Flickr image. A while ago I created a Twitter badge in flash for an indies band website, only to find 3 weeks later Twitter changed their api due to a security issue. Later I re-created [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">I&#8217;ve just added a little twitter ticker flickr thing on <a href="http://www.chrisherring.co.uk" target="_blank">chrisherring.co.uk</a> which looks at my <a href="http://twitter.com/chrisherring" target="_blank">Twitter posts</a> and fetches related Flickr image. A while ago I created a Twitter badge in flash for an indies band website, only to find 3 weeks later Twitter changed their api due to a security issue. Later I re-created the Twitter badge in Jquery using JSON. For this little project I decided to use <a href="http://en.wikipedia.org/wiki/JSON" target="_blank">JSON</a> as my data format, which can be parsed in AS3. </p>
<p style="text-align: left;">Looping through my recent Twitter posts I search for question marks or full stops etc with a regular expression which looks like this /\!|\?|\.|\&#8230;|\*/.  Upon finding a matching character I extract the preceding word, and query the Flick api for images tagged with the preceding word, then place the tagged image in the background.  In order to work around the security issue which arises when using Twitter and Flash, I use php to quickly copy my json feed and parse the local copy into flash. Below are some examples</p>
<p style="text-align: center;"><img class="aligncenter" src="http://blog.chrisherring.co.uk/wp-content/uploads/images/twitter_flickr_1.jpg" alt="" width="480" height="213" /></p>
<p style="text-align: center;">
<p style="text-align: center;"><img class="alignnone" src="http://blog.chrisherring.co.uk/wp-content/uploads/images/twitter_flickr_2.jpg" alt="" width="480" height="213" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.chrisherring.co.uk/2008/12/07/83/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Government 2.0</title>
		<link>http://blog.chrisherring.co.uk/2008/12/02/government-20/</link>
		<comments>http://blog.chrisherring.co.uk/2008/12/02/government-20/#comments</comments>
		<pubDate>Tue, 02 Dec 2008 13:39:30 +0000</pubDate>
		<dc:creator>blog.chrisherring.co.uk</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[data]]></category>

		<guid isPermaLink="false">http://blog.chrisherring.co.uk/?p=73</guid>
		<description><![CDATA[In last few weeks of November the Government admitted to losing one laptop per week since the child benefit database went walkabout with half populations information on it. In contrast whilst meandering my way through the internet I came Show Us A Better Way is competition run by the Government to encourage developers and such [...]]]></description>
			<content:encoded><![CDATA[<p>In last few weeks of November the Government admitted to losing one laptop per week since the child benefit database went <a href="http://www.telegraph.co.uk/news/newstopics/politics/3490630/Government-admits-it-is-losing-one-lap-top-a-week-on-anniversary-of-loss-of-child-benefit-database.html" target="_blank">walkabout</a> with half populations information on it. In contrast whilst meandering my way through the internet I came <a href="http://showusabetterway.co.uk/" target="_blank">Show Us A Better Way</a> is competition run by the Government to encourage developers and such like people to get create with public information. Slightly strange considering you have must have a very good chance of finding a Government laptop lying about anyway.</p>
<p>Unfortunately I only became aware of the competition, two weeks after the submission date had passed. But the idea is to make accessible the information which is often hidden or tucked away, on crime, health or education. Which is pretty cool and am looking forward to see who wins the competition.</p>
<p>Selected API&#8217;s<br />
<a href="http://www.nhs.uk/nhscwebservices/Pages/Webservices.aspx" target="_self">NHS<br />
</a><a href=" http://neighbourhood.statistics.gov.uk/dissemination/Info.do?page=nde.htm " target="_blank">Neighbourhood statistics<br />
</a><a href="http://openspace.ordnancesurvey.co.uk/openspace/ " target="_blank">Ordnancesurvey</a></p>
<p><strong>Related links</strong><br />
- <a href="http://showusabetterway.co.uk/" target="_blank">Show Us A Better Way<br />
</a> &#8211; <a href="http://powerofinformation.wordpress.com/" target="_blank">Power of Information</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.chrisherring.co.uk/2008/12/02/government-20/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Things to make and do</title>
		<link>http://blog.chrisherring.co.uk/2008/11/25/things-to-make-and-do/</link>
		<comments>http://blog.chrisherring.co.uk/2008/11/25/things-to-make-and-do/#comments</comments>
		<pubDate>Tue, 25 Nov 2008 12:39:02 +0000</pubDate>
		<dc:creator>blog.chrisherring.co.uk</dc:creator>
				<category><![CDATA[Experiments]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[bbc]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flickr]]></category>
		<category><![CDATA[lastfm]]></category>
		<category><![CDATA[musicbrainz]]></category>

		<guid isPermaLink="false">http://blog.chrisherring.co.uk/?p=40</guid>
		<description><![CDATA[Recently I&#8217;ve been working on a Lastfm and Flickr api mash up using Flash. The idea is you are able to search for images based upon the most listened to artists for a searched for Lastfm user. At the moment I&#8217;m integrating some extra information for the users popular artist and their related flickr images, [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I&#8217;ve been working on a <a href="http://www.last.fm/user/chrisherring" target="_blank">Lastfm</a> and <a href="http://flickr.com/photos/chrisherring" target="_blank">Flickr</a> api mash up using Flash. The idea is you are able to search for images based upon the most listened to artists for a searched for Lastfm user. At the moment I&#8217;m integrating some extra information for the users popular artist and their related flickr images, and possible some data visualisation.</p>
<p>While doing some research into my little project last month I discovered the beta version of the BBC Music page, on these two blog posts <a href="http://www.bbc.co.uk/blogs/bbcinternet/2008/07/bbc_music_artist_pages_beta.html" target="_blank">1</a>, <a href="http://derivadow.com/2008/07/28/the-all-new-bbc-music-site-where-programmes-meet-music-and-the-semantic-web/" target="_blank">2</a>. Not only are the blog post very interesting but they also go into some detail about the BBC&#8217;s integration of the <a href="http://musicbrainz.org/" target="_blank">MusicBrainz</a> community service. Each artist on MusicBrainz has an unique ID which looks like ba853904-ae25-4ebb-89d6-c44cfbd71bd2 and based upon this the BBC are then looking up artists related links, scraping information from Wikipedia and using it as part of the artists biography see Blur for <a href="http://www.bbc.co.uk/music/artists/ba853904-ae25-4ebb-89d6-c44cfbd71bd2" target="_blank">example</a>. Pretty cool I&#8217;ll hopefully write a longer post about this over the weekend.</p>
<p>Anyway back to what I was writing, I was thinking about using MusicBrainz api to conduct my searchs for related information on artists for the little <a href="http://www.last.fm/user/chrisherring" target="_blank">Lastfm</a> and Flickr api mash up I&#8217;m creating.</p>
<p>On chrisherring.co.uk I&#8217;ve added a diet version of my Flash api mash up as a banner, which searchs for my most popular music and fetches relating flickr images. The results are interesting as new photos are tagged, especially searching of Foals:</p>
<p>Radiohead:</p>
<p style="text-align: center;"><img class="aligncenter" src="http://blog.chrisherring.co.uk/wp-content/uploads/images/flash_radiohead.jpg" alt="" width="480" height="213" /></p>
<p style="text-align: left;">Foals:</p>
<p style="text-align: center;"><img class="aligncenter" src="http://blog.chrisherring.co.uk/wp-content/uploads/images/flash_foals.jpg" alt="" width="480" height="213" /></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.chrisherring.co.uk/2008/11/25/things-to-make-and-do/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
