Nike plus data API access
Posted by Paul, under runningAs Nike + wristband user and a web developer i thought it would interesting if i was able to access the raw data of my runs.
Nike provide various ‘widgets’ that can be embedded into web pages which is convenient and fun. But i find them a little clunky in flash. You can see an example of one I added to this site here. So i decided to see what I could find on the net to access the run data.
It turns out the everyone’s run data is accessible via a URL linking to a XML document. All that is required is your user ID. Simply go to the following URL and insert your user ID at the end of the string.
http://nikeplus.nike.com/nikeplus/v1/services/widget/get_public_run_list.jsp?userID=<YOUR ID HERE>
All my data can be accessed here for example. Please take note about the XML document
- Distances are in kilometres (despite having all my settings in miles).
- Time locals appear to be correct.
- Time is measured in millseconds
Now your probably wondering how do i find out my user ID. Do this:
- Sign into Nike Plus.
- Click ‘My Runs’.
- Click the ‘Share’ button on the top right of your runs.
- Click ‘Add to a Web page’.
- Click ‘Grab the Code’. Now it copied the code to your clip board.
- Open up a text editor and paste it in (ctrl v). You should have something like this below. The ID is highlighted, just copy it out
<object classid=”clsid:d27cdb6e-ae6d-11cf-96b8-444553540000″ codebase=”http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0″ width=”198″ height=”145″ id=”Nike+ Runs” align=”middle”><param name=”allowScriptAccess” value=”sameDomain” /><param name=”wmode” value=”transparent” /><param name=”movie” value=”http://nikeplus.nike.com/nikeplus/v1/swf/scrapablewidget/rundetail.swf” /><param name=”quality” value=”high” /><param name=”bgcolor” value=”#ffffff” /><param name=”FlashVars” value=”type=last5Runs&userDefaultUnit=mi&screenName=paulrichards&dateFormat=DD/MM/YY
&id=1759895612®ion=emea&language=en&locale=en_gb”/><embed src=”http://nikeplus.nike.com/nikeplus/v1/swf/scrapablewidget/rundetail.swf” quality=”high” wmode=”transparent” bgcolor=”#ffffff” width=”198″ height=”145″ name=”Nike+ Runs” align=”middle” allowScriptAccess=”sameDomain” FlashVars=”type=last5Runs&userDefaultUnit=mi&screenName=paulrichards&dateFormat=DD/MM/YY&id=1759895612®ion=emea&language=en&locale=en_gb” type=”application/x-shockwave-flash” pluginspage=”http://www.macromedia.com/go/getflashplayer”></embed></object>
Hi,
I’ve done this for some time using AJAX and parsing the nikeplus XML file inside a webbrowser. The problem with that is, that most browsers do not allow accessing XML files, which are not inside the same domain.
So far, there are afaik only two possibilities, how someone could use nike’s XML data:
[1] Get the file every x minutes by using a cronjob on your server (e.g. with wget).
[2] Parse the file within a server language (php, python, java) and output the pure html to the browser.
Yes your are right, it would be far to much for a web browser to process this on the go. I’m working on a little script (in PHP) that will cache the file every now and again and insert the information in a database for easy use.
Do you know an easier way to get your user id?
Hi Paul, I’m also interested in knowing if there’s an easier way of getting the user id. Any step forward on this?
Post a Comment