Returns group information for a specific group ID.
The response items returned in a groups.getGroups service call.
Name | Type | Description | Possible Values |
---|
id | INT | The ID of the group. | INT |
name | STRING | The name of the group. | STRING |
description | STRING | A brief blurb about the group. History, purpose, location, ideas, awards, etc. The description is searchable. | STRING |
note | STRING | Some text about the group. The note is not searchable. | STRING |
logo | INT | The media ID that is used as the group logo. | INT |
logo_height | INT | The original height of the media being used for the logo. | INT |
logo_width | INT | The original width of the media being used for the logo. | INT |
publicUrl | STRING | The url to access the group logo. The public url will log a hit against the media item when ever loaded. This would be best used on a group details page. | STRING |
thumbUrl | STRING | The url to access the group logo. The thumb url will _NOT_ log a hit against the media item when loaded. This is best used in group galleries or plotting groups on a map. | STRING |
url | STRING | The url of the group. This is used best if the group is for a company, an event with a unique url they wish to also direct traffic to. | STRING |
created | YYYY-MM-DD HH:mm:SS | The date the group was created. | YYYY-MM-DD HH:mm:SS |
createdBy | INT | The user ID of the user who created the group. | INT |
memberCount | INT | The number of members in the group. | INT |
mediaCount | INT | The number of media items in the group. | INT |
approvedMediaCount | INT | The number of approved media items in the group. | INT |
notDeniedMediaCount | INT | The number of not denied media items in the group. | INT |
commentCount | INT | The number of comments in the group. | INT |
approvedCommentCount | INT | The number of approved comments in the group. | INT |
notDeniedCommentCount | INT | The number of not denied comments in the group. | INT |
geo_longitude | LNG | The longitude of the group. This would be specified by the creator of the group. | NUMBER (-52.44) |
geo_latitude | LAT | The latitude of the group. This would be specified by the creator of the group. | NUMBER (62.86) |
moderationStatus | STRING | The moderation status of the group which has just been created. By default if this is not passed the groups moderationstatus will be unmoderated. | accepted, denied, unmoderated, moderated, notdenied, all |
parentGroup | INT | The ID of the parent group if the current group is a child. | INT |
address | STRING | The address of the group. | STRING |
city | STRING | The city that the group is located in. | INT |
country | STRING | The country that the group is located in. This will be a 2-letter country code. | STRING |
state | STRING | This will be the state/province that the group is located in. It will be a 2-letter state/province code. | STRING |
postalcode | STRING | A valid postal code to contact the group by. | STRING |
newMediaEmailTemplateID | INT | This is the ID of the email template that is sent out when a user uploads media into the group. | INT |
host | STRING | The name of the host who created the group or who is in charge of the group. | STRING |
groupType | INT | This specifies if the group is a group or an event. 1 represents a group, 2 represents an event and 3 represents an assignment. | 1, 2, 3 |
vhost | INT | The vhost ID that the group belongs to. | INT |
other | ARRAY | An associated array that is used to store any additional information about the group that does not fit in any previous fields. This field is _NOT_ searchable or filterable. This is equivalent to the metadata field for media. | ARRAY |
custom1 | STRING | A searchable and filterable field for any additional information that does not fit into any previous field. | STRING |
treeleft | INT | Used internally for the sorting and ordering groups. | INT |
treeright | INT | Used internally for the sorting and ordering groups. | INT |
email | STRING | The email address to use to allow users to email content to this email address and have it uploaded and entered into the group. | STRING |
totalCount | INT | If the includeTotalCount argument is set to true the total count of groups returned will be included in the response. | INT |
Sample REST Response
http://api.newspark.ca/services/rest/media/getGroup?groupId=[MID]&APIKEY=[APIKEY]
<?xml version="1.0" encoding="UTF-8"?>
<result>
<id>GROUP_ID</id>
<name>GROUP_NAME</name>
<description>This is a description field to briefly describe what exactly the API Reference is for and how it should be used.</description>
<note/>
<logo>0</logo>
<logo_height>0</logo_height>
<logo_width>0</logo_width>
<publicUrl/>
<thumbUrl/>
<url/>
<created>2012-01-20 12:12:46</created>
<createdBy>USER_ID</createdBy>
<memberCount>0</memberCount>
<mediaCount>0</mediaCount>
<approvedMediaCount>0</approvedMediaCount>
<notDeniedMediaCount>0</notDeniedMediaCount>
<geo_longitude>0</geo_longitude>
<geo_latitude>0</geo_latitude>
<moderationStatus>unmoderated</moderationStatus>
<parentGroup>PARENT_GROUP</parentGroup>
<address/>
<city/>
<country/>
<state/>
<postalcode/>
<newMediaEmailTemplateID>0</newMediaEmailTemplateID>
<host/>
<groupType>1</groupType>
<vhost>VHOSTID</vhost>
<other>
<key>value</key>
<other/>
<custom1>api</custom1>
<treeleft>12</treeleft>
<treeright>39</treeright>
<email/>
</result>
Sample JSON Response
{
"status": true,
"result": {
"id": "GROUP_ID",
"name": "GROUP_NAME",
"description": "This is a description field to briefly describe what exactly the API Reference is for and how it should be used.",
"note": "",
"logo": "0",
"logo_height": "0",
"logo_width": "0",
"publicUrl": "",
"thumbUrl": "",
"url": "",
"created": "2012-01-20 12:12:46",
"createdBy": "USER_ID",
"memberCount": "0",
"mediaCount": "0",
"approvedMediaCount": "0",
"notDeniedMediaCount": "0",
"geo_longitude": "0",
"geo_latitude": "0",
"moderationStatus": "unmoderated",
"parentGroup": "PARENT_GROUP_ID",
"address": "",
"city": "",
"country": "",
"state": "",
"postalcode": "",
"newMediaEmailTemplateID": "0",
"host": "",
"groupType": "1",
"vhost": "VHOSTID",
"other": {
"key": "value"
},
"custom1": "api",
"treeleft": "12",
"treeright": "39",
"email": ""
}
}
PHP-RPC
$path = 'https://api.newspark.ca/services/php';
// Listing the arguments
$arguments = array(
'APIKEY' => 'YOURAPIKEY',
'method' => 'groups.getGroup',
'groupId' => $groupId
);
// 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)
);
// Creating an XML-RPC message
$message = new XML_RPC_Message('groups.getGroup',$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
);
$data = $xmlrpc->invoke('groups.getGroup',$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
);
$data = $client->call('groups.getGroup',$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 = "getGroup";
myRemConn_rc.params = {groupId:groupId};
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);
var connection:NetConnection = new NetConnection();
connection.connect(gatewayURL);
connection.call("groups.getGroup", 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/getGroup"
dim apiKey as string = "YOURAPIKEY"
dim url as string = gateway & method & "?APIKEY=" & apiKey & "&groupId=" & groupId
' 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 getGroup ( groupId ) {
var params = {
"method" : 'groups.getGroup',
"groupId" : groupId}
$.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->getGroup( $groupId );
print_r($data);
back to top