MOStlyREST com_rest_stats


The MOStlyREST com_rest_stats component builds off the solid MOStlyREST com_rest base component. It implements a set of standard REST parameters for interacting with Mambo's statistical data. This provides valuable information to REST clients like the popular site search strings, number of hits per content item, hits by browser type, by operating system, by host, etc. It also provides a replica of mod_whosonline which can be used to see how may guests and registers users are current browsing your site. See the table below for information on allowed parameters and their meaning. See the Bridget sample app for a hands-on example of com_rest_stats.




RESTful API Parameters, Explanations, and Formats

Parameter Value Description
appid string (required) The application ID. See the wiki page on RESTful API registration for more information.
output string: json, xml, php The format the API response is to be returned in. More information on the return formats can be found later in this document.
callback string The name of the callback function to wrap around the JSON data. The following characters are allowed: A-Z a-z 0-9 . [] and _. If output=json has not been requested, this parameter has no effect.
type string: agent, content, whosonline, search Defines the type of request
  • agent = Browser, host, and operating system hit counts
  • content = Content items and their hits count returned in descending order by hit count (accepts a limit param)
  • whosonline = Mirrors mod_whosonline. Provides real-time counts for the number of guests and registered users on a site.
  • search = Returns search terms recorded for the site in descending order by hit count (accepts a limit param)

limit integer Used to limit the number of records returned. Can be used with requests where "type" is either equal to "search" or "content". Could be useful for pulling lists like the top 5 most popular search terms, etc.



Each request must start with a base URL. Below is a sample base URL. To build custom API requests the parameters discussed above can be combined and tacked onto the site's base URL.

Sample base URL:
http://example.com/index2.php?option=com_rest_stats&task=dataRetrival&no_html=1


Sample custom request URL:
http://example.com/index2.php?option=com_rest_stats&no_html=1&task=dataRetrival&type=agent&appid=6d3de928d82be8e391893aba0b07ed2324906f40&output=xml


API Sample Stats Responses


XML
<?xml version="1.0"?>
<ResultSet>
	<Result>
		<agent>Mozilla Firefox 2.0.0.14</agent>
		<type>0</type>
		<type_desc>Browser</type_desc>
		<hits>2</hits>
	</Result>
</ResultSet>


Serialized PHP
a:1:{
	i:0;O:8:"stdClass":4:{
		s:5:"agent";
		s:24:"Mozilla Firefox 2.0.0.14";
		s:4:"type";
		s:1:"0";
		s:9:"type_desc";
		s:7:"Browser";
		s:4:"hits";
		s:1:"2";
	}
}


JSON
[{
	"agent":"Mozilla Firefox 2.0.0.14",
	"type":"0",
	"type_desc":"Browser",
	"hits":"2"
}]
There are no comments on this page.
Page was generated in 0.0603 seconds