Returns a list of users based on provided parameters.
Name | Type | Description | Possible Values |
---|
CreationDate | Date | The date the user was created. | YYYY-mm-dd |
Username | String | The Username. | String |
Active | INT | Shows whether the user is active or not | 1 or 0 |
FirstName | String | The user's first name | any string |
LastName | String | The user's last name | any string |
Email | String | The user's Email | @.com |
Address1 | String | The user's address | String in address format |
Address2 | String | The user's address | String in address format |
City | String | The user's City | String |
State | String | The user's State | String |
PostalCode | String | The user's Postal Code | String in postal code format |
Country | String | The user's country | string |
Phone | String | The user's Phone number | ###-###-#### |
CellPhone | String | The user's cell phone number | ###-###-#### |
Gender | String | The user's gender | M or F |
DateOfBirth | String | The user's Date Of Birth | YYYY-mm-dd |
profile_complete | INT | Shows whether the user's profile is complete | 1 or 0 |
WebSite | String | The user's WebSite address | string in website format |
Occupation | String | The user's Occupation | string |
Latitude | String | The Latitude of the user's geo-location | 1.2345567 |
Longitude | String | The Longitude of the user's geo-location | 91.2345567 |
MetaData | String | The user's MetaData as a serialized array | a:1:{s:9:"fbconnect";i:0;} |
Files | INT | The number of files the user uploaded | 123 |
Sends | INT | The number of times the user sent a file to someone | 123 |
UserID | INT | The user's identification number | 1945346 |
Newsletter | INT | Shows whether the user opted in to the Newsletter or not | 1 or 0 |
UnmoderatedFiles | INT | The number of unmoderated files that the user has uploaded | 123 |
ApprovedFiles | INT | The number of approved files that the user has uploaded | 123 |
DeniedFiles | INT | The number of denied files that the user has uploaded | 123 |
PHP-RPC
$path = 'https://api.newspark.ca/services/php';
// Listing the arguments
$arguments = array(
'APIKEY' => 'YOURAPIKEY',
'method' => 'vhost.getUserDetails',
'vhostId' => $vhostId,
'startDate' => $startDate,
'endDate' => $endDate,
'active' => $active,
'gender' => $gender,
'pageIndex' => $pageIndex,
'pageSize' => $pageSize,
'sortBy' => $sortBy,
'sortOrder' => $sortOrder
);
// http_build_query basically turns an array into a url-encoded list of variables
$url = $path .'?' . http_build_query($arguments,null,'&');
// get the contents from the specified url
$data = file_get_contents($url);
// transform it back into php data structures
$data = unserialize($data);
// the actual data is stored in $data['result']
print_r($data['result']);
back to topPEAR XMLRPC client
// Include the client
require_once 'XML/RPC.php';
// Create the XMLRPC Client
$client = new XML_RPC_Client('/services/xmlrpc?APIKEY={YOURAPIKEY}', 'api.newspark.ca');
// PEAR's XML-RPC client requires all arguments to wrapped in a special value class
// XML_RPC_encode converts this automatically
$arguments = array(
XML_RPC_encode($vhostId),
XML_RPC_encode($startDate),
XML_RPC_encode($endDate),
XML_RPC_encode($active),
XML_RPC_encode($gender),
XML_RPC_encode($pageIndex),
XML_RPC_encode($pageSize),
XML_RPC_encode($sortBy),
XML_RPC_encode($sortOrder)
);
// Creating an XML-RPC message
$message = new XML_RPC_Message('vhost.getUserDetails',$arguments);
// Sending the message to the server
$response = $client->send($message);
// We also need to decode the response back to normal PHP types
$response = XML_RPC_decode($response);
print_r($response);
back to topSabreTooth XMLRPC client
// Include the client
require_once 'Sabre/XMLRPC/Client.php';
// Create the XMLRPC Client
$xmlrpc = new Sabre_XMLRPC_Client('https://api.newspark.ca/services/xmlrpc?APIKEY={YOURAPIKEY}');
$arguments = array(
$vhostId,
$startDate,
$endDate,
$active,
$gender,
$pageIndex,
$pageSize,
$sortBy,
$sortOrder
);
$data = $xmlrpc->invoke('vhost.getUserDetails',$arguments);
print_r($data);
back to topZend XMLRPC client
// Include the client
require_once 'Zend/XmlRpc/Client.php';
// Create the XMLRPC Client
$client = new Zend_XmlRpc_Client('https://api.newspark.ca/services/xmlrpc?APIKEY={YOURAPIKEY}');
$arguments = array(
$vhostId,
$startDate,
$endDate,
$active,
$gender,
$pageIndex,
$pageSize,
$sortBy,
$sortOrder
);
$data = $client->call('vhost.getUserDetails',$arguments);
print_r($data);
back to topActionscript 2
/*
* In ActionScript 2 remote service calls are done using the RemotingConnector Component.
* An instance of the component must exist on the stage and have an instance name.
*
* Results and Faults are handled by addEventListener's and the call parameters are placed inside of an associative array
*
* You must also specify the service class and method names under the appropriate property fields of the component
*/
var gatewayURL:String = "/services/amf2";
//Set up service call
myRemConn_rc.gatewayUrl = gatewayURL;
myRemConn_rc.serviceName = "vhost";
myRemConn_rc.methodName = "getUserDetails";
myRemConn_rc.params = {vhostId:vhostId, startDate:startDate, endDate:endDate, active:active, gender:gender, pageIndex:pageIndex, pageSize:pageSize, sortBy:sortBy, sortOrder:sortOrder};
myRemConn_rc.addEventListener("result", widgetResult);
myRemConn_rc.addEventListener("status", widgetFault);
//Make the call
myRemConn_rc.trigger();
/*
* Handles service result.
*/
function widgetResult(ev:Object){
//Do stuff
//Data is returned inside of ev.target.results
//(i.e. ev.traget.results.description or ev.traget.results.settings.color)
}
/*
* Handles service fault.
*/
function widgetFault(ev:Object){
//Display Error
trace("Categories Error - " + ev.code + " - " + ev.data.faultstring);
}
back to topActionscript 3
/*
* In ActionScript 3 remote service calls are done using the NetConnection Object.
* A Responder Object controls what functions handle successful or failed calls
* and any parameters for the call are placed in an array and passed as a parameter
* in the NetConnection.call() method.
*/
var gatewayURL:String = "/services/amf2";
var parameters:Array = new Array(vhostId, startDate, endDate, active, gender, pageIndex, pageSize, sortBy, sortOrder);
var connection:NetConnection = new NetConnection();
connection.connect(gatewayURL);
connection.call("vhost.getUserDetails", new Responder(widgetResult, widgetFault), parameters);
/*
* Handles service result.
*/
function widgetResult(ev:Object):void{
//Do stuff
//Data is returned inside of ev
//(i.e. ev.description or ev.settings.color)
}
/*
* Handles service fault.
*/
function widgetFault(ev:Object):void{
//Display Error
error.showError(parentClip, ev.code + " - " + ev.description, "Please refresh your browser to try again.");
error.x = (parentClip.width - error.width) / 2;
error.y = (parentClip.height - error.height) / 2;
}
back to topREST service example
<%@ Page Language="vb" %>
<%
' REST gateway
dim gateway as string = "http://api.newspark.ca/services/rest/"
' Service + method we're calling.
dim method as string = "vhost/getUserDetails"
dim apiKey as string = "YOURAPIKEY"
dim url as string = gateway & method & "?APIKEY=" & apiKey & "&vhostId=" & vhostId
' HTTP Client
dim wcHTTPScrape as new System.net.WebClient()
' Opening a stream
dim objInput as System.IO.Stream = wcHTTPScrape.OpenRead(url)
dim objReader as new System.IO.StreamReader ( objInput )
' Reading the entire HTTP response and output it
Response.Write ( objReader.ReadToEnd () )
objReader.Close ()
objInput.Close ()
%>
back to topjQuery JSON
/*
* jQuery post example
*/
function getUserDetails ( vhostId, startDate, endDate, active, gender, pageIndex, pageSize, sortBy, sortOrder ) {
var params = {
"method" : 'vhost.getUserDetails',
"vhostId" : vhostId,
"startDate" : startDate,
"endDate" : endDate,
"active" : active,
"gender" : gender,
"pageIndex" : pageIndex,
"pageSize" : pageSize,
"sortBy" : sortBy,
"sortOrder" : sortOrder}
$.post('/services/json',params
,function(response){
console.log(response);
});
back to topLocal API
// Get the Service Mapper
$mapper = Sabre_ServiceMap_Mapper::getMapper();
// Calling the method
$data = $mapper->vhost->getUserDetails( $vhostId, $startDate, $endDate, $active, $gender, $pageIndex, $pageSize, $sortBy, $sortOrder );
print_r($data);
back to top