WhatPulse WebAPI
The WebAPI is a way to retrieve statistics through a script for your website. (Or anything) In the examples coming up, a website will be the prefered target.
It works through XML files, and you can get about every statistic from this api. Before a file is created with your statistics in it, you have to tick 'Generate XML statistics (webapi)' in your profile. This is the same option for teams (only founders can turn it on)
These files are updated every 6 hours, at 3:00, 9:00, 15:00 and 21:00 GMT.
You can find them at:
- http://whatpulse.org/api/user.php?UserID=<your_userid>
- http://whatpulse.org/api/team.php?TeamID=<your_teamid>
For example, my stats: http://whatpulse.org/api/user.php?UserID=1
Webmasters
In the downloads section there are 2 scripts, a WebAPI user script and a team script. These are PHP scripts that contain functions to parse the statistics and put them in an array for easy use.
Example for using the user_parse.php script:
user_parse.php script
<?
$uid = 1; // Change this to your user ID
$err = 0; // Debug messages
require("user_parse.php");
$WP_stats = new WP_stats;
$stats = $WP_stats->get($uid, $err);
echo "<table>";
foreach ($stats as $id => $stat)
{
echo "<tr><td>".$id."</td><td>".$stat."</td></tr>";
}
echo "</table>";
?>
Example for using the team_parse.php script:
Team_parse.php script
<?
include"team_parse.php";
$team_stats = array();
$members = array();
// read stats of teamid 3
readTeamStats(3, &$team_stats, &$members);
print_r($team_stats);
print_r($members);
?>

