---
title: GroupsApi
---
## PureCloud::GroupsApi
All URIs are relative to *https://api.mypurecloud.com*
Method | HTTP request | Description
------------- | ------------- | -------------
|[**delete_group_id**](GroupsApi.html#delete_group_id) | **DELETE** /api/v2/groups/{groupId} | Delete group|
|[**delete_group_id_members**](GroupsApi.html#delete_group_id_members) | **DELETE** /api/v2/groups/{groupId}/members | Remove members|
|[**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_group_id_members**](GroupsApi.html#post_group_id_members) | **POST** /api/v2/groups/{groupId}/members | Add members|
|[**post_groups**](GroupsApi.html#post_groups) | **POST** /api/v2/groups | Create a group|
|[**post_search**](GroupsApi.html#post_search) | **POST** /api/v2/groups/search | Search|
|[**put_group_id**](GroupsApi.html#put_group_id) | **PUT** /api/v2/groups/{groupId} | Update group|
{: class="table table-striped"}
## -String** delete_group_id(group_id)
Delete 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
#Delete group
result = api_instance.delete_group_id(group_id)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling GroupsApi->delete_group_id: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**group_id** | **String**| Group ID |
{: class="table table-striped"}
### Return type
**String**
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## - delete_group_id_members(group_id, ids)
Remove 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
ids = "ids_example" # String | Comma separated list of userIds to remove
begin
#Remove members
api_instance.delete_group_id_members(group_id, ids)
rescue PureCloud::ApiError => e
puts "Exception when calling GroupsApi->delete_group_id_members: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**group_id** | **String**| Group ID |
**ids** | **String**| Comma separated list of userIds to remove |
{: class="table table-striped"}
### Return type
nil (empty response body)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**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(q64, 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
q64 = "q64_example" # String | q64
opts = {
expand: ["expand_example"] # Array | expand
}
begin
#Search using q64
result = api_instance.get_search(q64, opts)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling GroupsApi->get_search: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**q64** | **String**| q64 |
**expand** | [**Array<String>**](String.html)| expand | [optional]
{: class="table table-striped"}
### Return type
[**GroupsSearchResponse**](GroupsSearchResponse.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## - post_group_id_members(group_id, body)
Add 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
body = PureCloud::GroupMembersUpdate.new # GroupMembersUpdate | Add members
begin
#Add members
api_instance.post_group_id_members(group_id, body)
rescue PureCloud::ApiError => e
puts "Exception when calling GroupsApi->post_group_id_members: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**group_id** | **String**| Group ID |
**body** | [**GroupMembersUpdate**](GroupMembersUpdate.html)| Add members |
{: class="table table-striped"}
### Return type
nil (empty response body)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**Group**](Group.html) post_groups(body)
Create a 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
body = PureCloud::Group.new # Group | Group
begin
#Create a group
result = api_instance.post_groups(body)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling GroupsApi->post_groups: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Group**](Group.html)| Group |
{: class="table table-striped"}
### Return type
[**Group**](Group.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**GroupsSearchResponse**](GroupsSearchResponse.html) post_search(body)
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
body = PureCloud::GroupSearchRequest.new # GroupSearchRequest | Search request options
begin
#Search
result = api_instance.post_search(body)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling GroupsApi->post_search: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**GroupSearchRequest**](GroupSearchRequest.html)| Search request options |
{: class="table table-striped"}
### Return type
[**GroupsSearchResponse**](GroupsSearchResponse.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**Group**](Group.html) put_group_id(group_id, opts)
Update 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
opts = {
body: PureCloud::GroupUpdate.new # GroupUpdate | Group
}
begin
#Update group
result = api_instance.put_group_id(group_id, opts)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling GroupsApi->put_group_id: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**group_id** | **String**| Group ID |
**body** | [**GroupUpdate**](GroupUpdate.html)| Group | [optional]
{: class="table table-striped"}
### Return type
[**Group**](Group.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json