All you MovableType users can now use the PluginGyan-MT plugin to display your PublicGyan profile and predictions on your blog. A Wordpress plugin is being worked on.
Archive for the 'Developers' Category
Public Gyan has an XML RPC interface that you can query to get your profile data that you can then display on your website, blog etc. As such the script below cannot be used inside WordPress or MovableType. It needs to be converted into a plugin. But the information below should get all developers started.
The details of the service is as follows:
Server: http://www.publicgyan.com/RPC2/serv.php
Description: This function returns the profile details of a user, given his username. Returned values include userid, rank, total number of users in system and total worth of the user.
Function: user.getProfile
Argument: username (string)
Returns: A structure having the following fields..
fullname (If this value is not set, ‘Not Set’ will be returned)
uid
rank
totaluser
totalvalue
Description: This function returns the top ‘n’ busiest prediction on PublicGyan. ‘n’ is passed as argument and set to a maximum of 10.
Function: publicgyan.getBusyPredictions
Argument: number(int)
Returns: ‘n’ number of structures having the following fields..(n being the argument called with, max. of 10)
name
url
Description: This function returns the top ‘n’ newest prediction on PublicGyan. ‘n’ is passed as argument and set to a maximum of 10.
Function: publicgyan.getNewPredictions
Argument: number(int)
Returns: ‘n’ number of structures having the following fields.. (n being the argument called with, max. of 10)
name
url
Refresh frequency: The fetched data will be refreshed every hour. So, please do not use this service more frequently than that.
An example output of the profile call can be found here that shows the details of user with username ’srijith’. The php code (using the XML-RPC library of Keith Deves used to produce this result is as small as:
<?php
include('xmlrpc.php');
list($success, $response) = XMLRPC_request('www.publicgyan.com', '/RPC2/serv.php', 'user.getProfile',array(XMLRPC_prepare('srijith')));
print "UID =".$response['uid']."
";
print "Rank =".$response['rank']."
";
print "Users in system =".$response['totalusers']."
";
print "Total Worth=".$response['totalvalue'];
?>