Extracting information from a webservice

Dirk Hohndel dirk at hohndel.org
Thu Jan 17 08:44:34 PST 2013


On Jan 17, 2013, at 8:39 AM, Pierre-Yves wrote:
>>> Sounds more like what I have in mind.
>>> 
>>> I just pushed a change allowing to retrieve someone's dive in xml (documented in
>>> the /api/).
>>> 
>>> My idea would be:
>>> 1) text field in the preferences to set your user id
>>> 2) button "Sync GPS coordinate from subsurface-webservice"
>>>  2.1) call the /api/mydives/<user id>/xml/
>>>  2.2) load the xml returned
>>>  2.3) for each dive information returned, do some smart date matching to
>>>  associate the GPS coordinates with the dives already in subsurface.
>> 
>> I pulled the latest from git and restarted.
>> 
>> If I go to api.hohndel.org/api/mydives/<myuser>/xml/
>> 
>> This is what I get (cut off the userid...)
>> 
>> Aquarium 20.634331014 -156.497194301 2012-12-15 10:11:00 Cabbage+patch 26.2999706268 127.721084595 2012-10-08 10:41:00 Coral+Garden,+Gishiphu+Island 26.2359638214 127.366409302 2012-10-06 12:44:00 Garbanzos+Lair 20.6342663057 -156.497339141 2012-12-15 10:10:00 Gibraltar 36.1185531616 -5.35096406937 2012-11-09 12:37:00 Ginowan+Garden 26.2977266265 127.721336083 2012-10-08 09:05:00 Green+Reef,+Higa+River 26.3604189456 127.734137848 2012-10-07 09:48:00 Hotel+Vessel,+Okinawa 26.3152056606 127.754286518 2012-10-05 11:07:00 Kadina+Mae 26.347328186 127.7395401 2012-10-07 02:07:00 Kuroshima+South 26.2475814819 127.404373169 2012-10-06 10:44:00 La+Herradura 36.7252998352 -3.73605966568 2012-11-08 10:30:00 Paradiso,+Maejima 26.2218088796 127.447788566 2012-10-06 03:12:00 Red+Reef 26.3593559265 127.736663818 2012-10-08 01:31:00 mala+pier 20.8858438069 -156.688383752 2012-12-14 02:36:00 shanty+town 20.7309510978 -156.965660127 2012-12-18 10:05:00 shark+pit 20.8621345041 -156.67578307 2012-12-14 01:23:00 ok
>> 
>> That looks parsable, but not exactly like XML :-)
>> 
>> What am I missing?
> 
> Check the source of the page ;-)

Yeah. Truly. I completely missed that :-)

> I need to specify that the output returned is xml (now it's displaying the xml
> as if it was html).

Makes sense now. And that does indeed look easily parseable. When I have a moment later today I'll check if this can successfully imported with Subsurface (and if it is easier to change our parser or if it requires changes to the XML to be easily digestable).
Ideally this would then match the dives (more loosely than normal since you will have taken the GPS fix a few minutes before dive start or a few minutes after dive end) and then simply updates the dive…

If you or Lubumir have time to play with that right now, please say so here (so we don't duplicate work) and go ahead!


/D 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4130 bytes
Desc: not available
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20130117/2c2708bf/attachment.bin>


More information about the subsurface mailing list