Quantcast
Channel: GSAK Forum
Viewing all articles
Browse latest Browse all 75049

GcApi() by clyde - 2013-06-23

$
0
0
QUOTE
Please note that I do not know how you coded GSAK so it cannot possibly be obvious to me.

You don't need to know how I coded GSAK for some things to be obvious, so I refute your comment and say it could be possible rolleyes.gif . This was certainly one case where I *thought* it should, especially given your past knowledge of GSAK.

Reading between the lines it seems you want a "feature request" to allow you to easily process this data via a GPX load. However, as a work around I should be able to put you on the track to loading it now.

Basically you need to make your data look like a GPX file that is currently supported by GSAK for loading via "File=>Load gpx" (either via the GUI or the corresponding macro command). This means it must look like a GPX file generated by a PQ download (or single page) or one that I currently create from the SearchForGeocaches api call. Obviously the latter is the better fit as it contains all the details in the <a:Geocache> element. I haven't looked into this extensively, but a bit of testing and trial and error should get you there. However, as a rough guide this is what whould be needed:

1. utf-8 encode the data you get from gcapi() using your call (use the UTF8() function to do this)

2. Prefix your data with the following line:

CODE
<?xml version="1.0" encoding="utf-8"?>


3. As your are using a different api call than SearchForGeocaches, probably so to will be the first part of the response (though with some luck it may just be the same). So basically you must replace that section to make it look like the response data from SearchForGeocaches. The section I referer to is something like:

CODE
<GetGeocacheDataResponse xmlns="http://www.geocaching.com/Geocaching.Live/data" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<Status>
 <StatusCode>0</StatusCode>
 <StatusMessage>OK</StatusMessage>
 <ExceptionDetails/>
 <Warnings/>
</Status>
<Geocaches xmlns:a="http://schemas.datacontract.org/2004/07/Tucson.Geocaching.WCF.API.Geocaching.Types">


Again, I haven't looked into this extensively but I think the critical element here (and possibly the only thing you will need to change ) is making sure is starts with "GetGeocachesDataResponse". So it should just be a case of replacing your api call repsonse string with this one (use the Replace() function)

4. Make sure the very last line in your data is: (the replace() in step 3 will *probably* already do this for you).

CODE
</GetGeocacheDataResponse>


Now save this data to a file (with a .gpx extension) and it should load into GSAK via the GPX load dialog.

Note1: One other item you may need to consider is this information at the very end:

CODE
<PQCount>0</PQCount>
<CacheCodes xmlns:a="http://schemas.microsoft.com/2003/10/Serialization/Arrays"/>
<CacheLimits xmlns:a="http://schemas.datacontract.org/2004/07/Groundspeak.API.AuthorizationLib">
 <a:CachesLeft>5978</a:CachesLeft>
 <a:CurrentCacheCount>22</a:CurrentCacheCount>
 <a:MaxCacheCount>6000</a:MaxCacheCount>
</CacheLimits>


It is provided when we use the SearchForGeocaches api call but I don't know if any of it will be present with the call you are using. I am not even sure GSAK *needs* this information to be present, so you will need to test and possibly insert some dummy data just so it will load.

Note2: I suggest you take a copy of one of the GPX files generated when doing a refresh (or get caches, as they both use the SearchForGeocaches api call) so you can open up and interrogate to see exactly what you need to change to get it to work. However, everything between <a:Geocache> and </a:Geocache> should be the same and and shouldn't need any changes. Fore example if you refresh a single cache you should find a file call "Refresh0.gpx" in the folder [application data]\temp - just take a copy of this file and interrogate.

Viewing all articles
Browse latest Browse all 75049

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>