As some of you probably know, I’ve been working on a PHP class providing access to the recently released NewsGator API. I was making some pretty good progress about a week ago as I tore through the first 2 “sections” of commands (‘Locations’ and ‘Folders’). Then I got stuck on a problem with ‘Subscriptions’ and didn’t have time to stop and investigate further.
Just tonight, I was finally able (and willing) to delve back into that API code and figure out my problem. Turns out it was… wait for it… a bad API spec:
XmlElement GetSubscriptionList(locationName, syncToken)
Returns the user’s subscriptions, including the folder hierarchy defined in NewsGator Online, for the specified locationName (NOT location ID), using the syncToken as advice for generating synchronization information on the server. The result of this call is an OPML document with NewsGator extensions.
Notice the italicized portion? Where they explicitly state that it should be the locationName, NOT the location ID? Well, apparently they didn’t really mean that… They go on to specify in the list of parameters locationName as the name of the first one.
When specifying a name for the locationName parameter, one is greeted with the following output:
[faultcode] => soap:Server
[faultstring] => Procedure ‘GetMachineID’ expects parameter ‘@MachineIdStr’, which was not supplied.
Well well, it would appear they didn’t actually mean location name when they specifically said it, did they? After a bit of trial and error, it turns out that they will actually accept either a locationName or a locationId, as long as you call the parameter location!
I haven’t continued on through any of the other operations in this section, but I imagine they will all be the same, since they all call for the same locationName parameter… Gee, thanks NewsGator for fucking with my head!
Now the real question is, are you going to correct this error on the back-end or the front-end? If you correct it on the back-end (changing the actual “location” parameter to “locationName”), it will screw up all my code. If you change it on the front-end, it may not be the exact intended functionality, but it won’t screw up anyone who has figured this out on their own.