Returns a list of groups for a specific vhost
Pagination may be controlled via the "startPage" and "pageSize" parameters
The optional "sort" argument is a string that can be used to specify one field to sort the returned groups by.The sort parameter can also include a sort direction ("ASC" or "DESC").
All groups returned will have a last resort sort applied based on the unique group ID to ensure a consistent ordering of groups even when the specified sort field is not unique. Example: sort="membercount DESC" - This will return a list of groups with the groups with the most members first. If multiple groups have the same number of members then the ones with identical member counts will be ordered by ID equivalent to sort="membercount DESC, id".
To arrange the groups or events in the same order as they appear in the tree within MediaFactory you must sort by "treeleft ASC". The fields supported for sorting are: membercount, id, created ,mediacount ,approvedmediacount ,notdeniedmediacount ,name, treeleft.
array groups.getGroups ( int vhost, int uid = NULL, string moderationStatus = 'accepted', array filters = array(), string sort = 'created DESC', int startPage = false, int pageSize = false, bool includeTotalCount = false, bool noLimit = false, bool childGroupCount = false, int groupType = 1 )
Name | Type | Required | Default value | Description |
---|---|---|---|---|
vhost | int | Required | none | The vhost ID that the group belongs to. |
uid | int | Optional | NULL | Filter by and only return groups that the given user ID is a member of. |
moderationStatus | string | Optional | 'accepted' | Filter the group list by the specified moderation status. The possible values are "accepted", "denied", "unmoderated", "moderated", "notdenied","all". |
filters | array | Optional | array() | See the list of possible filters for groups.getGroups service below. |
sort | string | Optional | 'created DESC' | Sets the sort field. Use the format fieldname ASC/DESC. Currently created, distance, membercount, mediacount, id, approvedmediacount, notdeniedmediacount, name, startdate, enddate, and treeleft are supported. To retrieve the groups in the same order they are in the group-event tree use "treeleft ASC". |
startPage | int | Optional | false | Sets the startpage for the group list. This is used with pagination in conjunction with pageSize. The starting page index is 0 (the first page). |
pageSize | int | Optional | false | Sets the total number of items returned per page. This is used with pagination and in conjunction with startPage. The maximum number of groups to include on each page by default is 100 and the maximum is 5000. |
includeTotalCount | bool | Optional | false | If "includeTotalCount" is "true" then the total number of matching groups will be returned along with the groups themselves. If it's "false" then the total count will not be returned. The default for includeTotalCount is false. |
noLimit | bool | Optional | false | You may disable all pagination and limits on the number of groups returned by setting the "noLimit" parameter to "true". This requires the groups.getGroupsNoLimit permission. |
childGroupCount | bool | Optional | false | If "childGroupCount" is "true" then the total number of child groups will be returned for the parengGroupId. If it's "false" then the total count will not be returned. The default for childGroupCount is false. |
groupType | int | Optional | 1 | This is used to specify a specific group type. If a group is not of the specified group type it will not be returned. If a group is a child of a group that is not of the specified group type, it will not be returned. This argument may be one or more of the following values: 1 (groups), 2 (events) 3 (assignments) or null (return all groups, assignments and events). NB: You may specify multiple groupTypes. For example: passing '1,3' will return data for Groups and Assignments. |
The optional "filters" parameter is an array that may contain the following keys and values.
Name | Type | Description | Default | Possible Values |
---|---|---|---|---|
creatorUserID | INT | Returns only groups created by the specified user ID. If the user ID specified is not the user that is currently logged in and is not the public user then a check is made for the "groups.getGroups" permission. | empty | INT |
custom1 | STRING | A string that must match the value of the custom1 field of the groups returned. | empty | STRING |
endAfter | DATETIME | Returns groups that end after the specified date. | empty | DATETIME |
endBefore | DATETIME | Returns groups that end before the specified date. | empty | DATETIME |
geoCenter | COORDINATES | Center coordinates to filter from lat,long eg. 43.6355,-79.4245 | empty | COORDINATES |
geoDistance | INT | Distance in meters from geoCenter coordinates | empty | INT |
geoBoundaries | [float LAT, float LNG, float LAT, float LNG] | Return media that is located inside the bounding box made up of the latitude and longitude cooridinites. Specify as an array: [north-west lat, north-west long, south-east lat, south-east long] ([62.86,-52.44,35.08,-131.55]) to receive media within the cooridinites. | empty | [float LAT, float LNG, float LAT, float LNG] |
geo | STRING | Set this to 'notnull' to return only the groups that have valid geo-location values, meaning ones with geo_latitude <> null and geo_longitude <> null | empty | |
includeChildren | BOOL | Returns all groups who have parentGroupID as their ancestor. May only be used in combination with the parentGroupID filter. | true | false |
mediaID | INT | A media item that must be present within the groups returned | empty | INT |
parentGroupID | INT | Returns only groups whose parent is the group specified. | INT | INT |
searchDescription | STRING | A string that must exist in the description of the groups returned. | empty | STRING |
searchName | STRING | A string that must exist in the name of the groups returned. | empty | STRING |
searchQuery | STRING | A string that must exist in at least one of the following fields. | empty | name, description, address, host, city |
startAfter | DATETIME | Returns groups that start after the specified date. | empty | DATETIME |
startBefore | DATETIME | Returns groups that start before the specified date. | empty | DATETIME |
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 | A note 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 current moderation status of the group. | 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 |
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 | |
distancefromcenter | FLOAT | The number of metres a groups latitude, longitude is from the latitude/longitude specified by geoCenter filter, otherwise this is empty | FLOAT |
totalCount | INT | If the includeTotalCount argument is set to true the total count of groups returned will be included in the response. | INT |
<?xml version="1.0" encoding="UTF-8"?> <result> <childGroupCount>2</childGroupCount> <item> <id>GROUP_ID</id> <name>GROUP_NAME</name> <description/> <note/> <logo>0</logo> <publicUrl/> <thumbUrl/> <url/> <created>2012-02-03 14:25:30</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_ID</parentGroup> <address/> <city/> <country/> <state/> <postalcode/> <newMediaEmailTemplateID>0</newMediaEmailTemplateID> <host/> <groupType>1</groupType> <vhost>VHOST_ID</vhost> <other> <key>value</key> </other> <custom1/> <treeleft>36</treeleft> <treeright>37</treeright> <email/> </item> <item> <id>GROUP_ID</id> <name>GROUP_NAME</name> <description/> <note/> <logo>0</logo> <publicUrl/> <thumbUrl/> <url/> <created>2012-02-03 14:25:11</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_ID</parentGroup> <address/> <city/> <country/> <state/> <postalcode/> <newMediaEmailTemplateID>0</newMediaEmailTemplateID> <host/> <groupType>1</groupType> <vhost>VHOST_ID</vhost> <other/> <custom1/> <treeleft>34</treeleft> <treeright>35</treeright> <email/> </item> <totalCount>2</totalCount> </result>
{ "status": true, "result": { "0": { "id": "GROUP_ID", "name": "GROUP_NAME", "description": "", "note": "", "logo": "0", "publicUrl": "", "thumbUrl": "", "url": "", "created": "2012-02-13 09:24:24", "createdBy": "USER_ID", "memberCount": "0", "mediaCount": "0", "approvedMediaCount": "0", "notDeniedMediaCount": "0", "geo_longitude": "0", "geo_latitude": "0", "moderationStatus": "unmoderated", "parentGroup": "0", "address": "", "city": "", "country": "", "state": "", "postalcode": "", "newMediaEmailTemplateID": "0", "host": "", "groupType": "1", "vhost": "VHOST_ID", "other": { "key": "value" }, "custom1": "", "treeleft": "63", "treeright": "64", "email": "GROUP_CREATOR_EMAIL_ADDRESS" }, "1": { "id": "GROUP_ID", "name": "GROUP_NAME", "description": "", "note": "", "logo": "0", "publicUrl": "", "thumbUrl": "", "url": "", "created": "2012-02-13 09:16:29", "createdBy": "1", "memberCount": "0", "mediaCount": "0", "approvedMediaCount": "0", "notDeniedMediaCount": "0", "geo_longitude": "0", "geo_latitude": "0", "moderationStatus": "unmoderated", "parentGroup": "0", "address": "", "city": "", "country": "", "state": "", "postalcode": "", "newMediaEmailTemplateID": "0", "host": "", "groupType": "1", "vhost": "VHOST_ID", "other": [], "custom1": "", "treeleft": "61", "treeright": "62", "email": "GROUP_CREATOR_EMAIL_ADDRESS" } "childGroupCount": "2", "totalCount": "2" } }