API Reference

Groups.getGroupTree

Returns a tree of all groups and events.

If the moderation status filter is set then only groups with the given moderation status will be returned. If a group does not have the given moderation status and does have children then its children will not be returned.

If the parent group filter is set then only children of the specified parent will be returned.


Syntax

array groups.getGroupTree ( int vhostID = 0, string moderationStatus = 'accepted', int parentGroup = 0, int groupType = NULL, mixed vhost = 0, mixed uid = 0, mixed removeEmptyChildNodes = 0 )

Arguments

NameTypeRequiredDefault valueDescription
vhostIDintOptional0The vhost ID that the group belong to.
moderationStatusstringOptional'accepted'Only return groups with the specified moderation status'. If a group with children does not have the given moderation status the parent group and its children will not be returned.
parentGroupintOptional0The parent group ID if you only want the children of specific groups returned.
groupTypeintOptionalNULLThis 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.
vhostmixedOptional0
uidmixedOptional0
removeEmptyChildNodesmixedOptional0

Response

The response will be an array of items of all groups and / or events from the vhost. Each parent will also include an array of all if its children too.

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
noteSTRINGSome text 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 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
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
childrenARRAYThe children item will return an array of _ALL_ of the groups children with the same information that has been returned for the current parent group.ARRAY

Sample Response

Sample REST Response
http://api.newspark.ca/services/rest/groups/getGroupTree?vhostID=[VHOST_ID]
<?xml version="1.0" encoding="UTF-8"?>
<result>
  <item>
    <id>9584</id>
    <name>Documentation</name>
    <description/>
    <note/>
    <logo>0</logo>
    <logo_height>0</logo_height>
    <logo_width>0</logo_width>
    <publicUrl/>
    <thumbUrl/>
    <url/>
    <created>2012-01-20 16:16:19</created>
    <createdBy>41799</createdBy>
    <memberCount>0</memberCount>
    <mediaCount>0</mediaCount>
    <approvedMediaCount>0</approvedMediaCount>
    <notDeniedMediaCount>0</notDeniedMediaCount>
    <geo_longitude>0</geo_longitude>
    <geo_latitude>0</geo_latitude>
    <moderationStatus>accepted</moderationStatus>
    <parentGroup>0</parentGroup>
    <address/>
    <city/>
    <country/>
    <state/>
    <postalcode/>
    <newMediaEmailTemplateID>0</newMediaEmailTemplateID>
    <host/>
    <groupType>1</groupType>
    <vhost>231</vhost>
    <other/>
    <custom1/>
    <treeleft>1</treeleft>
    <treeright>46</treeright>
    <email/>
    <children>
      <item>
        <id>9575</id>
        <name>Overview</name>
        <description/>
        <note/>
        <logo>0</logo>
        <publicUrl/>
        <thumbUrl/>
        <url/>
        <created>2012-01-20 12:13:12</created>
        <createdBy>41799</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>9584</parentGroup>
        <address/>
        <city/>
        <country/>
        <state/>
        <postalcode/>
        <newMediaEmailTemplateID>0</newMediaEmailTemplateID>
        <host/>
        <groupType>1</groupType>
        <vhost>231</vhost>
        <other/>
        <custom1/>
        <treeleft>2</treeleft>
        <treeright>11</treeright>
        <email/>
        <children>
          <item>
            <id>9581</id>
            <name>Introduction</name>
            <description/>
            <note/>
            <logo>0</logo>
            <publicUrl/>
            <thumbUrl/>
            <url/>
            <created>2012-01-20 15:25:49</created>
            <createdBy>41799</createdBy>
            <memberCount>0</memberCount>
            <mediaCount>4</mediaCount>
            <approvedMediaCount>1</approvedMediaCount>
            <notDeniedMediaCount>3</notDeniedMediaCount>
            <geo_longitude>0</geo_longitude>
            <geo_latitude>0</geo_latitude>
            <moderationStatus>accepted</moderationStatus>
            <parentGroup>9575</parentGroup>
            <address/>
            <city/>
            <country/>
            <state/>
            <postalcode/>
            <newMediaEmailTemplateID>0</newMediaEmailTemplateID>
            <host/>
            <groupType>1</groupType>
            <vhost>231</vhost>
            <other/>
            <custom1/>
            <treeleft>3</treeleft>
            <treeright>6</treeright>
            <email/>
            <children/>
          </item>
        </children>
      </item>
      <item>
        <id>9574</id>
        <name>API Reference</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>
        <publicUrl/>
        <thumbUrl/>
        <url/>
        <created>2012-01-20 12:12:46</created>
        <createdBy>41799</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>9584</parentGroup>
        <address/>
        <city/>
        <country/>
        <state/>
        <postalcode/>
        <newMediaEmailTemplateID>0</newMediaEmailTemplateID>
        <host/>
        <groupType>1</groupType>
        <vhost>231</vhost>
        <other/>
        <custom1>api</custom1>
        <treeleft>12</treeleft>
        <treeright>39</treeright>
        <email/>
        <children>
          <item>
            <id>9594</id>
            <name>Getting Started</name>
            <description/>
            <note/>
            <logo>0</logo>
            <publicUrl/>
            <thumbUrl/>
            <url/>
            <created>2012-01-24 10:21:49</created>
            <createdBy>41799</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>9574</parentGroup>
            <address/>
            <city/>
            <country/>
            <state/>
            <postalcode/>
            <newMediaEmailTemplateID>0</newMediaEmailTemplateID>
            <host/>
            <groupType>1</groupType>
            <vhost>231</vhost>
            <other/>
            <custom1/>
            <treeleft>13</treeleft>
            <treeright>14</treeright>
            <email/>
            <children/>
          </item>
        </children>
      </item>
    </children>
  </item>
</result>
Sample JSON Response
{
    "status": true,
    "result": [
        {
            "id": "GROUP_ID",
            "name": "GROUP_NAME",
            "description": "",
            "note": "",
            "logo": "0",
            "logo_height": "0",
            "logo_width": "0",          
            "publicUrl": "",
            "thumbUrl": "",
            "url": "",
            "created": "2012-01-20 16:16:19",
            "createdBy": "USER_ID",
            "memberCount": "0",
            "mediaCount": "0",
            "approvedMediaCount": "0",
            "notDeniedMediaCount": "0",
            "geo_longitude": "0",
            "geo_latitude": "0",
            "moderationStatus": "accepted",
            "parentGroup": "0",
            "address": "",
            "city": "",
            "country": "",
            "state": "",
            "postalcode": "",
            "newMediaEmailTemplateID": "0",
            "host": "",
            "groupType": "1",
            "vhost": "VHOST_ID",
            "other": [],
            "custom1": "",
            "treeleft": "1",
            "treeright": "46",
            "email": "",
            "children": [
                {
                    "id": "GROUP_ID",
                    "name": "GROUP_NAME",
                    "description": "",
                    "note": "",
                    "logo": "0",
                    "publicUrl": "",
                    "thumbUrl": "",
                    "url": "",
                    "created": "2012-01-20 12:13:12",
                    "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": "VHOST_ID",
                    "other": [],
                    "custom1": "",
                    "treeleft": "2",
                    "treeright": "11",
                    "email": "",
                    "children": [
                        {
                            "id": "GROUP_ID",
                            "name": "GROUP_NAME",
                            "description": "",
                            "note": "",
                            "logo": "0",
                            "publicUrl": "",
                            "thumbUrl": "",
                            "url": "",
                            "created": "2012-01-20 15:25:49",
                            "createdBy": "USER_ID",
                            "memberCount": "0",
                            "mediaCount": "4",
                            "approvedMediaCount": "1",
                            "notDeniedMediaCount": "3",
                            "geo_longitude": "0",
                            "geo_latitude": "0",
                            "moderationStatus": "accepted",
                            "parentGroup": "PARENT_GROUP_ID",
                            "address": "",
                            "city": "",
                            "country": "",
                            "state": "",
                            "postalcode": "",
                            "newMediaEmailTemplateID": "0",
                            "host": "",
                            "groupType": "1",
                            "vhost": "VHOST_ID",
                            "other": [],
                            "custom1": "",
                            "treeleft": "3",
                            "treeright": "6",
                            "email": "",
                            "children": []
                        }
                    ]
                },
                {
                    "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",
                    "publicUrl": "",
                    "thumbUrl": "",
                    "url": "",
                    "created": "2012-01-20 12:12:46",
                    "createdBy": "USER_NAME",
                    "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": "VHOST_ID",
                    "other": [],
                    "custom1": "api",
                    "treeleft": "12",
                    "treeright": "39",
                    "email": "",
                    "children": []
                }
            ]
        },
        {
            "id": "GROUP_ID",
            "name": "GROUP_NAME",
            "description": "TEST DESCRIPTION",
            "note": "",
            "logo": "0",
            "publicUrl": "",
            "thumbUrl": "",
            "url": "",
            "created": "2012-01-27 15:46:38",
            "createdBy": "USER_ID",
            "memberCount": "0",
            "mediaCount": "1",
            "approvedMediaCount": "0",
            "notDeniedMediaCount": "0",
            "geo_longitude": "0",
            "geo_latitude": "0",
            "moderationStatus": "denied",
            "parentGroup": "0",
            "address": "",
            "city": "",
            "country": "",
            "state": "",
            "postalcode": "",
            "newMediaEmailTemplateID": "0",
            "host": "",
            "groupType": "1",
            "vhost": "VHOST_ID",
            "other": [],
            "custom1": "",
            "treeleft": "47",
            "treeright": "48",
            "email": "",
            "children": []
        }
    ]
}

Code examples

0 comments

Be the first to comment on getGroupTree.

Add a Comment

  • captcha