rhub
sign in
map people groups locations

  # ? homehelp

Api, Helper Class

The helper class makes it easier code against public rhub.net APIs.

Get the source code

[edit] Example

Simple queries using the developer's user account:

require_once("classes/ApiClient.inc");
$myDevId = "200";
$myDevPass = "345dfg54g";
$api = new ApiClient($myDevId, $myDevPass);

// Perform request, echoing the result:
$r = $api->PerformGetRequest("util.php", array("op" => "whoami"));

echo($r);

Returns (if developer's name is 'clint')
<Response error="false" version="1.0">
<user>clint</user>
<id>2</id>
<hasImage>T</hasImage>
<fullName>Clint</fullName>
</Response>


Impersonating a user using their services password:

require_once("classes/ApiClient.inc");
$myDevId = "200";
$myDevPass = "345dfg54g";
$cred = new Credentials("bob", "servicePassword");
$api = new ApiClient($myDevId, $myDevPass, $cred);

// Perform request, echoing the result:
$r = $api->PerformGetRequest("util.php", array("op" => "whoami"), $cred);
echo($r);

Returns:

<Response error="false" version="1.0">
<user>bob</user>
<id>4</id>
<hasImage>T</hasImage>
<fullName>Bobby Jones</fullName>
</Response>

[edit] See Also

Retrieved from "http://rhub.net/wiki/Api%2C_Helper_Class"
Powered by MediaWiki

 

Help! | Console | Getting Started | Sitemap | Search | Feedback | About

Navigation
 
Personal tools

Extra