Get a list of game activity for a user.
Filters allow you to restrict the data that is returned. Below is a list of valid filters.
| Name | Type | Description | Default Values | 
|---|
| startTime | STRING | This attribute filters by the action date. No actions created before the startTime will be returned. Usually you should use the 'YYYY-MM-DD HH:MM:SS' format, but using the following values will also work: 'yesterday', 'midnight', 'today', 'now', 'noon', or 'tomorrow'. | empty | 
| endTime | STRING | This attribute filters by the action date. No actions created past the endTime will be returned. Usually you should use 'YYYY-MM-DD HH:MM:SS' format, but using the following values will also work: 'yesterday', 'midnight', 'today', 'now', 'noon', or 'tomorrow'. | empty | 
| userId | INT | The user you request to filter actions by, all users without this filter (with the appropriate permissions, otherwise the logged in user actions | logged in user or all based on permissions  | 
| actionid | INT | The specific action to filter on | empty  | 
| type | INT | Filter on the Type associated with the game's rule. | empty  | 
Below you will find a list and description of all of the available options you can provide to the service. 
Below you will find a list and description of all of the available fields to have returned with our game.getUserLog service. 
| Name | Description | 
|---|
| id | The entry id  | 
| seen | If the entry has been marked as seen or not 0 for not seen, 1 for seen. | 
| icon | The badge or icon associated with this event.  | 
| info | Additional information about the event.  | 
| actionId | The action triggered by this event  | 
| logText | Custom text configured in the game settings, which can make use of our template system.  | 
| uid | The user id associated with the action.  | 
| actionTime | The time the action occurred  | 
| pointsearned | How many points the user earned or lost during this action . | 
| subjectid | The Id of the object involved in the action, can be a user id, a media id, a group, channel, or collectionn.  | 
| firstname | The first name of the user associated with the action  | 
| lastname | The last name of the user associated with the action.  | 
| user | The user name associated with the action | 
                                                        PHP-RPC
$path = 'https://api.newspark.ca/services/php';
// Listing the arguments
$arguments = array(
  'APIKEY' => 'YOURAPIKEY',
  'method' => 'game.getUserLog',
  'vhostid' => $vhostid,
  'userid' => $userid,
  'start' => $start,
  'limit' => $limit,
  'pointsonly' => $pointsonly,
  'filters' => $filters,
  'options' => $options
);
// 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($userid),
  XML_RPC_encode($start),
  XML_RPC_encode($limit),
  XML_RPC_encode($pointsonly),
  XML_RPC_encode($filters),
  XML_RPC_encode($options)
);
// Creating an XML-RPC message
$message = new XML_RPC_Message('game.getUserLog',$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,
  $userid,
  $start,
  $limit,
  $pointsonly,
  $filters,
  $options
);
$data = $xmlrpc->invoke('game.getUserLog',$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,
  $userid,
  $start,
  $limit,
  $pointsonly,
  $filters,
  $options
);
$data = $client->call('game.getUserLog',$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 = "game";
    myRemConn_rc.methodName = "getUserLog";
    myRemConn_rc.params = {vhostid:vhostid, userid:userid, start:start, limit:limit, pointsonly:pointsonly, filters:filters, options:options};
    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, userid, start, limit, pointsonly, filters, options);
    var connection:NetConnection = new NetConnection();
    connection.connect(gatewayURL);
    connection.call("game.getUserLog", 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 = "game/getUserLog"
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 getUserLog ( vhostid, userid, start, limit, pointsonly, filters, options ) {
var params = {
    "method" :      'game.getUserLog',
    "vhostid" :     vhostid,
    "userid" :      userid,
    "start" :       start,
    "limit" :       limit,
    "pointsonly" :  pointsonly,
    "filters" :     filters,
    "options" :     options}
$.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->game->getUserLog( $vhostid, $userid, $start, $limit, $pointsonly, $filters, $options );
print_r($data);
back to top