Monday, October 21, 2013

SPOT tracker API update

I've been noticing a fair amount of activity on my write-your-own-tracker post and I thought I ought to give a heads-up that there have been changes to the SPOT API, some rather major.  For the most part these seem to have been implemented to accommodate the new SPOT 3 and the updated services.  Without having dinked with it, the API described in my old post has apparently been deprecated and is no longer available (or may not be available in the future).  There's a new URI to retrieve the data.  Definitely rely on the information in the SPOT API web page, not my previous post, for what you'll need to be able to parse the SPOT messages.

From the description of the updated API:

Battery State will be sent along with most message types, not every message will have it, but most of them will.  It has two states.  Examples:

ModelID will also appear in the XML.  Values:

Three new message types as well.  

The new message types are undocumented, unfortunately, and may take some experimentation to sort out (they're clearly related to the SPOT 3).  What they're not telling you and also appears to be undocumented is that the overall format of the feed has changed, being no longer a messageList.  It is now a response and contains new elements, including a feedMessageResponse which itself contains a feed element with metadata describing the device and service, and the messages themselves.  Note that the messageList element is now called messages and that it's deeper in the tree.  There's also a new element tagged hidden in the message (no, I have no idea, either).

I should add that if I were coding this up today I'd use the JSON-formatted response, both for ease of parsing and for efficiency.

So basically, while the old post may still be useful for examples of how to parse XML in Javascript, how to do some basic things with the Google Maps API, etc., the URI needs to change to accommodate the updated API, and the XML (or JSON!) parsing will need to be tweaked.

No comments:

Post a Comment