API Reference

Groups.getGroups

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.


Syntax

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 )

Arguments

NameTypeRequiredDefault valueDescription
vhostintRequirednoneThe vhost ID that the group belongs to.
uidintOptionalNULLFilter by and only return groups that the given user ID is a member of.
moderationStatusstringOptional'accepted'Filter the group list by the specified moderation status. The possible values are "accepted", "denied", "unmoderated", "moderated", "notdenied","all".
filtersarrayOptionalarray()See the list of possible filters for groups.getGroups service below.
sortstringOptional'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".
startPageintOptionalfalseSets the startpage for the group list. This is used with pagination in conjunction with pageSize. The starting page index is 0 (the first page).
pageSizeintOptionalfalseSets 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.
includeTotalCountboolOptionalfalseIf "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.
noLimitboolOptionalfalseYou 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.
childGroupCountboolOptionalfalseIf "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.
groupTypeintOptional1This 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.

Optional Filters

The optional "filters" parameter is an array that may contain the following keys and values.

NameTypeDescriptionDefaultPossible Values
creatorUserIDINTReturns 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.emptyINT
parentGroupIDINTReturns only groups whose parent is the group specified.INTINT
includeChildrenBOOLReturns all groups who have parentGroupID as their ancestor. May only be used in combination with the parentGroupID filter.truefalse
searchQuerySTRINGA string that must exist in at least one of the following fields.emptyname, description, address, host, city
searchNameSTRINGA string that must exist in the name of the groups returned.emptySTRING
searchDescriptionSTRINGA string that must exist in the description of the groups returned.emptySTRING
custom1STRINGA string that must match the value of the custom1 field of the groups returned.emptySTRING
mediaIDINTA media item that must be present within the groups returnedemptyINT
geoCenterCOORDINATESCenter coordinates to filter from lat,long eg. 43.6355,-79.4245 emptyCOORDINATES
geoDistanceINTDistance in meters from geoCenter coordinatesemptyINT
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]
geoSTRINGSet this to 'notnull' to return only the groups that have valid geo-location values, meaning ones with geo_latitude <> null and geo_longitude <> nullempty

Response

The response items returned in a groups.getGroups service call.

NameTypeDescriptionPossible Values
idINTThe ID of the group.INT
nameSTRINGThe name of the group.STRING
descriptionSTRINGA brief blurb about the group. History, purpose, location, ideas, awards, etc. The description is searchable.STRING
noteSTRINGA note about the group. The note is not searchable.STRING
logoINTThe media ID that is used as the group logo.INT
logo_heightINTThe original height of the media being used for the logo.INT
logo_widthINTThe original width of the media being used for the logo.INT
publicUrlSTRINGThe 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
thumbUrlSTRINGThe 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
urlSTRINGThe 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
createdYYYY-MM-DD HH:mm:SSThe date the group was created.YYYY-MM-DD HH:mm:SS
createdByINTThe user ID of the user who created the group.INT
memberCountINTThe number of members in the group.INT
mediaCountINTThe number of media items in the group.INT
approvedMediaCountINTThe number of approved media items in the group.INT
notDeniedMediaCountINTThe number of not denied media items in the group.INT
commentCountINTThe number of comments in the group.INT
approvedCommentCountINTThe number of approved comments in the group.INT
notDeniedCommentCountINTThe number of not denied comments in the group.INT
geo_longitudeLNGThe longitude of the group. This would be specified by the creator of the group.NUMBER (-52.44)
geo_latitudeLATThe latitude of the group. This would be specified by the creator of the group.NUMBER (62.86)
moderationStatusSTRINGThe current moderation status of the group.accepted, denied, unmoderated, moderated, notdenied, all
parentGroupINTThe ID of the parent group if the current group is a child.INT
addressSTRINGThe address of the group.STRING
citySTRINGThe city that the group is located in.INT
countrySTRINGThe country that the group is located in. This will be a 2-letter country code.STRING
stateSTRINGThis will be the state/province that the group is located in. It will be a 2-letter state/province code.STRING
postalcodeSTRINGA valid postal code to contact the group by.STRING
newMediaEmailTemplateIDINTThis is the ID of the email template that is sent out when a user uploads media into the group.INT
hostSTRINGThe name of the host who created the group or who is in charge of the group.STRING
groupTypeINTThis 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
vhostINTThe vhost ID that the group belongs to.INT
otherARRAYAn 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
custom1STRINGA searchable and filterable field for any additional information that does not fit into any previous field.STRING
treeleftINTUsed internally for the sorting and ordering groups.INT
treerightINTUsed internally for the sorting and ordering groups.INT
emailSTRINGThe email address to use to allow users to email content to this email address and have it uploaded and entered into the group.STRING
distancefromcenterFLOATThe number of metres a groups latitude, longitude is from the latitude/longitude specified by geoCenter filter, otherwise this is emptyFLOAT
totalCountINTIf the includeTotalCount argument is set to true the total count of groups returned will be included in the response.INT

Sample Response

Sample REST Response
http://api.filemobile.com/services/rest/groups/getGroups?vhost=[VHOST_ID]&includeTotalCount=true&filters[includeChildren]=true&filters[parentGroupID]=[PARENT_GROUP_ID]&moderationStatus=all&childGroupCount=true
<?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>
Sample JSON Response
{
    "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"
    }
}

Code examples

0 comments

Be the first to comment on getGroups.

Add a Comment

  • captcha