GSAK (Geocaching Swiss Army Knife)
GcApi(sMethod,[sPostData]) : string
This function is for advanced users and gives you access to the Groundspeak live api.
sMethod - The api method to call (see Groundspeak live api link above).
sPostData - Optional and only required if the method uses post data.
The return string of this function is the XML data returned by the api call, or the error message if the api call ended in error. To determine if the api call ended in error use the system variable $_GcApiError, this variable should be tested after each api call to see if there was an error or not.
To make the parsing out of the returned XML data easier, the function will also automatically create the table "gcapi", in your current database. This table is basically the same as that generated by the XmlToSqlite command.
For methods that only return a small amount of data it may be easier to just manually parse out the xml from the return value of this function. For methods that return many elements then using Sqlite (use action SqlGet to iterate over the entries) to query the gcapi table is probably the better way to go
The gcapi table is only updated when $_GcApiError = False
For example, to show a list of users that favorited the current cache the macro code would be:
Api methods that need post data are a little harder to construct.
However, to give you an idea of how to use post data requests, here is the macro code to get the status of a couple of caches:
More helpful information on the api can be found in this thread.
Alpha List Category List
Copyright 2004-2011 CWE Computer Services |