Legacy THNapi:Stats DB API Formats

From Neocron Wiki
Revision as of 12:08, 26 July 2013 by Brammers (talk | contribs) (Created page with "== Formats == Data from the Stats DB API is available in 4 formats. JSON, Javascript (JS) RSS and HTML. == JSON == This is the preferred choice of data format for the Stats...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Formats

Data from the Stats DB API is available in 4 formats. JSON, Javascript (JS) RSS and HTML.

JSON

This is the preferred choice of data format for the Stats DB. It should be noted that some of the graph feeds provide data in a format more suitable the Stats DB graphs. In these cases it is better to use the raw data service provided.

Example: http://stats.techhaven.org/api/data/en/servers/info.json

JS

The JavaScript format is provided to allow websites to make a Ajax call to retrieve data in the required format. See JSONP for more information.

When using the .js format, the callback and return parameters must be specified.

Example: http://stats.techhaven.org/api/data/en/servers/info.js?return=json&callback=some_js_function_name

RSS

The RSS feeds are provided primarily for the for THN CPU bot on the Neocron IRC server. The RSS feeds contain additional data in the XML thn namespace. The data and format in this namespace is likely to change without notice.

Example: http://stats.techhaven.org/api/data/en/servers/info.rss

HTML

Some services are available to display in HTML, so it can be embedded direct into a webpage. It should be noted that these feeds are primarily for use on the THN, and the design/layout of the HTML produced is likely to change without notice.

The HTML produced usually contains header links to the required CSS and JS files to produce the HTML in the correct format. These can be excluded if required with the addition ? and ? parameters.

Example: http://stats.techhaven.org/api/data/en/servers/info.html