A few people have asked about how I pulled some of the URLs for communicating with the Nike servers. It all started with the WordPress plugin which revealed the first pair of URLs we needed and how to utilize them.
The first URL is called and returns this XML structure and a cookie needed to call the second URL.
The second URL returns an XML structure that contains all the basic run data:
<?xml version="1.0" encoding="UTF-8"?>
<title><![CDATA[Wake Up Hate]]></title>
As you can see, it has all my basic info, even as to which avatar I picked for my account. It is this data we use to make the info you see in the current sidebar. Next, knowing that the Nike+ iPod widgets published for use with Yahoo Widgets could get challenges and goal data, I downloaded them, grepped the files for “http” and got a bunch of results which yielded these URLs:
and knowing that the https URLs were authenticated with login=USERNAME&password=PASSWORD&locale=en_us
(be sure to replace my en_us locale with your own locale), then I could make use of the above to grab data. Except if you look a the first two URLs we made use of, “app” is in place of “widget”. So with a little substition, we get an XML response that we can parse to get runIDs, challengeIDs, and goalIDs.
The next mystery is how to get and make use of the TOKEN. After much fooling around with the above URLs, I realized that the generate_token and generate_pin were really doing the same thing. So that this call
generated something like this structure:
and 02A3E14F-09E7-7230-3C43-4BAF31FC5A33 turns out to be the token/pin that can be used in the bottom three URLs to take you to the Flash pages showing the challenge, goal, and run data. This is the equivalent of the username and password pair for getting you onto the nikeplus.com site. And no, that is not my real real PIN. =) This seems to really only be useful for the runner, and not very interesting for anyone the runner is sharing with.
The rest of the work is parsing and processing the various results of the authenticated URLs. Note that the nikeplus.com site has been undergoing some serious growing pains after the 2006 holiday season and has been a bit flaky. For this reason, the caching ability of the nikeplus script is very important. And even now they have chosen to update their widgets and the authentication URL is returning “login from locale not allowed” while the widgets themselves say “We’re actively restoring the nikeplus Yahoo Widgets. Your patience is trophy-worthy. Check back soon! Upgrade”. Their community boards are full of complaints about this, but hopefully they will get past this problem.
On their site they have a new Resolutions Flash widget for web sites that makes use of the same ID info for challenges and goals. As you can see, I’m very much behind on my goal.
In my next installment, we’ll go over what the data for run, goal, and challenges XML looks like.