Web API Overview
From Blue Mars Developer Guidebook
Below we compare the available functions for sending HTTP requests to a web server (submitting or downloading data) to help you decide which suits your needs.
- ARDownloadFile saves the returned data to the user directory; wrapper functions are available which format the parameters for the URL
- ARWebUtils.DownloadFile receives the response in a callback function rather than saving to the user directory
ARDownloadFile(url, destfile, options)
This function downloads an XML file to the user directory which can be read in with ARLoadXML.
It is also used by the ARSubmitGet and ARSubmitPost(url, dest, params, options) convenience functions, which wrap ARDownloadFile and pass in an additional table of parameters. The parameters are converted into HTTP submission format with ARDownloadParamString.
See Web for further details.
This method is necessary if you need to parse XML. Otherwise, it may be simpler to use the following utility.
ARWebUtils.DownloadFile(url, options, callback)
The benefit of this function is that it handles the returned data via a callback function, avoiding the need to manage saving to and reading from a file in the user directory.
Unlike ARDownloadFile it does not allow for parsing XML and unlike ARSubmitGet and ARSubmitPost parameters need to be pre-formatted in the URL.
See ARWebUtils for further details.