groups
Get a collection of groups, based on the parameters passed.
Examples
All Groups – Active
http://localhost/api/userplus/groups/?key=KEY-HERE
All Groups – Random
http://localhost/api/userplus/groups/?key=KEY-HERE&type=random
All Groups – Popular
http://localhost/api/userplus/groups/?key=KEY-HERE&type=popular
All Groups – Alphabetical
http://localhost/api/userplus/groups/?key=KEY-HERE&type=alphabetical
All Groups – Newest
http://localhost/api/userplus/groups/?key=KEY-HERE&type=newest
Resource URL
https://www.domain.com/api/userplus/groups/
Method
POST
Required Parameters
- key – get API key from Settings > User Plus
Optional Parameters
- 'type'
(string) Optional. Shorthand for certain orderby/order combinations. 'newest', 'active', 'popular', 'alphabetical', 'random'. When present, will override orderby and order params. Default: null. - 'orderby'
(string) Optional. Property to sort by. 'date_created', 'last_activity', 'total_member_count', 'name', 'random', 'meta_id'. Default: 'date_created'. - 'order'
(string) Optional. Sort order. 'ASC' or 'DESC'. Default: 'DESC'. - 'per_page'
(int) Optional. Number of items to return per page of results. Default: null (no limit). - 'page'
(int) Optional. Page offset of results to return. Default: null (no limit). - 'user_id'
(int) Optional. If provided, results will be limited to groups of which the specified user is a member. Default: null. - 'slug'
(array|string) Optional. Array or comma-separated list of group slugs to limit results to. Default: false. - 'search_terms'
(string) Optional. If provided, only groups whose names or descriptions match the search terms will be returned. Allows specifying the wildcard position using a '*' character before or after the string or both. Works in concert with $search_columns. Default: false. - 'search_columns'
(string) Optional. If provided, only apply the search terms to the specified columns. Works in concert with $search_terms. Default: empty array. - 'group_type'
(array|string) Array or comma-separated list of group types to limit results to. - 'group_type__in'
(array|string) Array or comma-separated list of group types to limit results to. - 'group_type__not_in'
(array|string) Array or comma-separated list of group types that will be excluded from results. - 'meta_query'
(array) Optional. An array of meta_query conditions. See WP_Meta_Query::queries for description. - 'value'
(array|string) Optional. Array or comma-separated list of group IDs. Results will be limited to groups within the list. Default: false. - 'parent_id'
(array|string) Optional. Array or comma-separated list of group IDs. Results will be limited to children of the specified groups. Default: null. - 'exclude'
(array|string) Optional. Array or comma-separated list of group IDs. Results will exclude the listed groups. Default: false. - 'update_meta_cache'
(bool) Whether to pre-fetch groupmeta for the returned groups. Default: true. - 'update_admin_cache'
(bool) Whether to pre-fetch administrator IDs for the returned groups. Default: false. - 'show_hidden'
(bool) Whether to include hidden groups in results. Default: false. - 'status'
(array|string) Optional. Array or comma-separated list of group statuses to limit results to. If specified, $show_hidden is ignored. Default: empty array. - 'fields'
(string) Which fields to return. Specify 'ids' to fetch a list of IDs. Default: 'all' (return BP_Groups_Group objects). If set, meta and admin caches will not be prefetched.
Sample Request URL
https://www.domain.com/api/userplus/groups/?key=54faf3a5b0ab5
Sample Response
{
"status": "ok",
"data": {
"groups": [
{
"id": 4,
"creator_id": 1,
"name": "Private Boating group",
"slug": "private-boating-group",
"description": "this is desc of the boating group, right now it is private",
"status": "private",
"parent_id": 0,
"enable_forum": 0,
"date_created": "2019-09-30 12:08:24",
"args": null
},
{
"id": 3,
"creator_id": 1,
"name": "Second group",
"slug": "second-group",
"description": "this is desc of 2nd group",
"status": "public",
"parent_id": 0,
"enable_forum": 0,
"date_created": "2019-08-28 13:32:37",
"args": null
},
{
"id": 2,
"creator_id": 16,
"name": "My first Group update",
"slug": "my-first-group",
"description": "first group desc",
"status": "public",
"parent_id": 0,
"enable_forum": 0,
"date_created": "2019-02-26 10:08:46",
"args": null
}
],
"total": 3
},
"page": 1,
"per_page": 20
}
Related Endpoints
- groups_create_group
- groups_delete_group
- groups_delete_groupmeta
- groups_edit_group_settings
- groups_get_avatar
- groups_get_cover
- groups_get_group
- groups_get_groupmeta
- groups_invite_user
- groups_invite_users_admin
- groups_is_user_admin
- groups_is_user_member
- groups_is_user_mod
- groups_join_group
- groups_join_group_admin
- groups_leave_group
- groups_members
- groups_post_update
- groups_send_membership_request
- groups_update_group
- groups_update_groupmeta