---
title: GroupsApi
---
## PureCloud::GroupsApi
All URIs are relative to *https://api.mypurecloud.com*
Method | HTTP request | Description
------------- | ------------- | -------------
|[**get_group_id**](GroupsApi.html#get_group_id) | **GET** /api/v2/groups/{groupId} | Get group|
|[**get_group_id_members**](GroupsApi.html#get_group_id_members) | **GET** /api/v2/groups/{groupId}/members | Get group members|
|[**get_groups**](GroupsApi.html#get_groups) | **GET** /api/v2/groups | Get a group list|
|[**get_search**](GroupsApi.html#get_search) | **GET** /api/v2/groups/search | Search using q64|
|[**post_search**](GroupsApi.html#post_search) | **POST** /api/v2/groups/search | Search|
{: class="table table-striped"}
## -[**Group**](Group.html) get_group_id(group_id)
Get group
### Example
~~~ruby
# load the gem
require 'purecloud'
# setup authorization
@secret = ENV['PURECLOUD_SECRET']
@id = ENV['PURECLOUD_CLIENT_ID']
environment = "mypurecloud.com"
@authToken = PureCloud.authenticate_with_client_credentials @id, @secret, environment
PureCloud.configure do |config|
config.access_token = @authToken
end
api_instance = PureCloud::GroupsApi.new
group_id = "group_id_example" # String | Group ID
begin
#Get group
result = api_instance.get_group_id(group_id)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling GroupsApi->get_group_id: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**group_id** | **String**| Group ID |
{: class="table table-striped"}
### Return type
[**Group**](Group.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**UserEntityListing**](UserEntityListing.html) get_group_id_members(group_id, opts)
Get group members
### Example
~~~ruby
# load the gem
require 'purecloud'
# setup authorization
@secret = ENV['PURECLOUD_SECRET']
@id = ENV['PURECLOUD_CLIENT_ID']
environment = "mypurecloud.com"
@authToken = PureCloud.authenticate_with_client_credentials @id, @secret, environment
PureCloud.configure do |config|
config.access_token = @authToken
end
api_instance = PureCloud::GroupsApi.new
group_id = "group_id_example" # String | Group ID
opts = {
page_size: 25, # Integer | Page size
page_number: 1, # Integer | Page number
sort_order: "ASC" # String | Ascending or descending sort order
}
begin
#Get group members
result = api_instance.get_group_id_members(group_id, opts)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling GroupsApi->get_group_id_members: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**group_id** | **String**| Group ID |
**page_size** | **Integer**| Page size | [optional] [default to 25]
**page_number** | **Integer**| Page number | [optional] [default to 1]
**sort_order** | **String**| Ascending or descending sort order | [optional] [default to ASC]
{: class="table table-striped"}
### Return type
[**UserEntityListing**](UserEntityListing.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**GroupEntityListing**](GroupEntityListing.html) get_groups(opts)
Get a group list
### Example
~~~ruby
# load the gem
require 'purecloud'
# setup authorization
@secret = ENV['PURECLOUD_SECRET']
@id = ENV['PURECLOUD_CLIENT_ID']
environment = "mypurecloud.com"
@authToken = PureCloud.authenticate_with_client_credentials @id, @secret, environment
PureCloud.configure do |config|
config.access_token = @authToken
end
api_instance = PureCloud::GroupsApi.new
opts = {
page_size: 25, # Integer | Page size
page_number: 1, # Integer | Page number
sort_order: "ASC" # String | Ascending or descending sort order
}
begin
#Get a group list
result = api_instance.get_groups(opts)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling GroupsApi->get_groups: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**page_size** | **Integer**| Page size | [optional] [default to 25]
**page_number** | **Integer**| Page number | [optional] [default to 1]
**sort_order** | **String**| Ascending or descending sort order | [optional] [default to ASC]
{: class="table table-striped"}
### Return type
[**GroupEntityListing**](GroupEntityListing.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**GroupsSearchResponse**](GroupsSearchResponse.html) get_search(opts)
Search using q64
### Example
~~~ruby
# load the gem
require 'purecloud'
# setup authorization
@secret = ENV['PURECLOUD_SECRET']
@id = ENV['PURECLOUD_CLIENT_ID']
environment = "mypurecloud.com"
@authToken = PureCloud.authenticate_with_client_credentials @id, @secret, environment
PureCloud.configure do |config|
config.access_token = @authToken
end
api_instance = PureCloud::GroupsApi.new
opts = {
q64: "q64_example", # String |
expand: ["expand_example"] # Array |
}
begin
#Search using q64
result = api_instance.get_search(opts)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling GroupsApi->get_search: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**q64** | **String**| | [optional]
**expand** | [**Array<String>**](String.html)| | [optional]
{: class="table table-striped"}
### Return type
[**GroupsSearchResponse**](GroupsSearchResponse.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**GroupsSearchResponse**](GroupsSearchResponse.html) post_search(opts)
Search
### Example
~~~ruby
# load the gem
require 'purecloud'
# setup authorization
@secret = ENV['PURECLOUD_SECRET']
@id = ENV['PURECLOUD_CLIENT_ID']
environment = "mypurecloud.com"
@authToken = PureCloud.authenticate_with_client_credentials @id, @secret, environment
PureCloud.configure do |config|
config.access_token = @authToken
end
api_instance = PureCloud::GroupsApi.new
opts = {
body: PureCloud::SearchRequest.new # SearchRequest | Search request options
}
begin
#Search
result = api_instance.post_search(opts)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling GroupsApi->post_search: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**SearchRequest**](SearchRequest.html)| Search request options | [optional]
{: class="table table-striped"}
### Return type
[**GroupsSearchResponse**](GroupsSearchResponse.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json