NB: To delete a group, you use the function updateGroup, and set the moderationStatus to deleted.
newInfo is an array that consists of the information that you want to have updated in your group.
Name | Type | Required | Default | Possible Values | Description |
---|
email | string | no | | email@example.com | The email address that users can use to email media into the group. |
description | string | no | | string | A blurb of text that describes what the group is all about. The description is searchable. |
logo | int | no | 0 | 5000444 | A media ID for a piece of media that is to be used as the group logo. The default value is 0, which means that the group has no logo assigned to it. |
url | string | no | | http://example.com | The url for the group. |
createdBy | int | no | 1 | 4155555 | The UID of the user who created the group. |
note | string | no | | string | Some text about the group. The note is not searchable. |
geo_longitude | float | no | 0 | -52.44 | The longitude of the group. This would be specified by the creator of the group. |
geo_latitude | float | no | 0 | 62.86 | The latitude of the group. This would be specified by the creator of the group. |
moderationStatus | string | no | unmoderated | unmoderated, accepted, denied, deleted, notdenied, moderated, all | The moderation status once the group has been created in MediaFactory. |
address | string | no | | string | The address of the group. This is used if the group is a company, branch etc. This would be the office location. |
city | string | no | | Toronto | A city that the group is associated with. |
country | string | no | | CA, US | The 2-letter country code for the group location. |
state | string | no | | ON | The 2-letter state / province code for the group. |
postalcode | string | no | | M1M1M1 | A valid postal code to contact the group. |
other | array | no | | {'key': 'value'} | This is any additional information about the group that does not fit into the fields above. |
custom1 | string | no | | string | A searchable string for additional content that you want stored about the group. |
startDate | timestamp | no | 0000-00-00 00:00:00 | 2012-02-15 00:00:00 | The date and time that the group begins. |
endDate | timestamp | no | 0000-00-00 00:00:00 | 2012-03-25 14:10:11 | The date and time that the group ends. |
parentGroup | int | no | 0 | 9499 | The ID of the parent group for the group to be created. The default value is 0, which means that the group has no parent; it is the top-level. |
The expected response for a successful update group request.
PHP-RPC
$path = 'https://api.newspark.ca/services/php';
// Listing the arguments
$arguments = array(
'APIKEY' => 'YOURAPIKEY',
'method' => 'groups.updateGroup',
'groupId' => $groupId,
'newInfo' => $newInfo
);
// 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($groupId),
XML_RPC_encode($newInfo)
);
// Creating an XML-RPC message
$message = new XML_RPC_Message('groups.updateGroup',$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(
$groupId,
$newInfo
);
$data = $xmlrpc->invoke('groups.updateGroup',$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(
$groupId,
$newInfo
);
$data = $client->call('groups.updateGroup',$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 = "groups";
myRemConn_rc.methodName = "updateGroup";
myRemConn_rc.params = {groupId:groupId, newInfo:newInfo};
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(groupId, newInfo);
var connection:NetConnection = new NetConnection();
connection.connect(gatewayURL);
connection.call("groups.updateGroup", 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 = "groups/updateGroup"
dim apiKey as string = "YOURAPIKEY"
dim url as string = gateway & method & "?APIKEY=" & apiKey & "&groupId=" & groupId & "&newInfo=" & newInfo
' 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 updateGroup ( groupId, newInfo ) {
var params = {
"method" : 'groups.updateGroup',
"groupId" : groupId,
"newInfo" : newInfo}
$.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->groups->updateGroup( $groupId, $newInfo );
print_r($data);
back to top