---
title: AuthorizationApi
---
## PureCloud::AuthorizationApi
All URIs are relative to *https://api.mypurecloud.com*
Method | HTTP request | Description
------------- | ------------- | -------------
|[**delete_roles_role_id**](AuthorizationApi.html#delete_roles_role_id) | **DELETE** /api/v2/authorization/roles/{roleId} | Delete an organization role.|
|[**delete_user_id_roles**](AuthorizationApi.html#delete_user_id_roles) | **DELETE** /api/v2/users/{userId}/roles | Removes all the roles from the user.|
|[**get_objects_object_id**](AuthorizationApi.html#get_objects_object_id) | **GET** /api/v2/authorization/objects/{objectId} | Returns a permission-protected object, showing the permission contexts it belongs to.|
|[**get_permissions**](AuthorizationApi.html#get_permissions) | **GET** /api/v2/authorization/permissions | Get all permissions.|
|[**get_products**](AuthorizationApi.html#get_products) | **GET** /api/v2/authorization/products | Get the list of enabled products|
|[**get_roles**](AuthorizationApi.html#get_roles) | **GET** /api/v2/authorization/roles | Retrieve a list of all roles defined for the organization|
|[**get_roles_leftrole_id_comparedefault_rightrole_id**](AuthorizationApi.html#get_roles_leftrole_id_comparedefault_rightrole_id) | **GET** /api/v2/authorization/roles/{leftRoleId}/comparedefault/{rightRoleId} | Get an org role to default role comparison comparison|
|[**get_roles_role_id**](AuthorizationApi.html#get_roles_role_id) | **GET** /api/v2/authorization/roles/{roleId} | Get a single organization role.|
|[**get_user_id_roles**](AuthorizationApi.html#get_user_id_roles) | **GET** /api/v2/users/{userId}/roles | Returns a listing of roles and permissions for a user.|
|[**patch_roles_role_id**](AuthorizationApi.html#patch_roles_role_id) | **PATCH** /api/v2/authorization/roles/{roleId} | Patch Organization Role for needsUpdate Field|
|[**post_roles**](AuthorizationApi.html#post_roles) | **POST** /api/v2/authorization/roles | Create an organization role.|
|[**post_roles_default**](AuthorizationApi.html#post_roles_default) | **POST** /api/v2/authorization/roles/default | Restores all default roles|
|[**post_roles_leftrole_id_comparedefault_rightrole_id**](AuthorizationApi.html#post_roles_leftrole_id_comparedefault_rightrole_id) | **POST** /api/v2/authorization/roles/{leftRoleId}/comparedefault/{rightRoleId} | Get an unsaved org role to default role comparison|
|[**put_roles_default**](AuthorizationApi.html#put_roles_default) | **PUT** /api/v2/authorization/roles/default | Restore specified default roles|
|[**put_roles_role_id**](AuthorizationApi.html#put_roles_role_id) | **PUT** /api/v2/authorization/roles/{roleId} | Update an organization role.|
|[**put_roles_role_id_users_add**](AuthorizationApi.html#put_roles_role_id_users_add) | **PUT** /api/v2/authorization/roles/{roleId}/users/add | Sets the users for the role|
|[**put_roles_role_id_users_remove**](AuthorizationApi.html#put_roles_role_id_users_remove) | **PUT** /api/v2/authorization/roles/{roleId}/users/remove | Removes the users from the role|
|[**put_user_id_roles**](AuthorizationApi.html#put_user_id_roles) | **PUT** /api/v2/users/{userId}/roles | Sets the user's roles|
{: class="table table-striped"}
## - delete_roles_role_id(role_id)
Delete an organization role.
### 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::AuthorizationApi.new
role_id = "role_id_example" # String | Role ID
begin
#Delete an organization role.
api_instance.delete_roles_role_id(role_id)
rescue PureCloud::ApiError => e
puts "Exception when calling AuthorizationApi->delete_roles_role_id: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**role_id** | **String**| Role ID |
{: class="table table-striped"}
### Return type
nil (empty response body)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## - delete_user_id_roles(user_id)
Removes all the roles from the user.
### 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::AuthorizationApi.new
user_id = "user_id_example" # String | User ID
begin
#Removes all the roles from the user.
api_instance.delete_user_id_roles(user_id)
rescue PureCloud::ApiError => e
puts "Exception when calling AuthorizationApi->delete_user_id_roles: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**user_id** | **String**| User ID |
{: class="table table-striped"}
### Return type
nil (empty response body)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**AuthzObject**](AuthzObject.html) get_objects_object_id(object_id)
Returns a permission-protected object, showing the permission contexts it belongs to.
### 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::AuthorizationApi.new
object_id = "object_id_example" # String | Object ID
begin
#Returns a permission-protected object, showing the permission contexts it belongs to.
result = api_instance.get_objects_object_id(object_id)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling AuthorizationApi->get_objects_object_id: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**object_id** | **String**| Object ID |
{: class="table table-striped"}
### Return type
[**AuthzObject**](AuthzObject.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**PermissionCollectionEntityListing**](PermissionCollectionEntityListing.html) get_permissions(opts)
Get all permissions.
Retrieve a list of all permission defined in the system.
### 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::AuthorizationApi.new
opts = {
page_size: 25, # Integer | Page size
page_number: 1 # Integer | Page number
}
begin
#Get all permissions.
result = api_instance.get_permissions(opts)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling AuthorizationApi->get_permissions: #{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]
{: class="table table-striped"}
### Return type
[**PermissionCollectionEntityListing**](PermissionCollectionEntityListing.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**OrganizationProductEntityListing**](OrganizationProductEntityListing.html) get_products
Get the list of enabled products
Gets the list of enabled products. Some example product names are: collaborateFree, collaboratePro, communicate, and engage.
### 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::AuthorizationApi.new
begin
#Get the list of enabled products
result = api_instance.get_products
p result
rescue PureCloud::ApiError => e
puts "Exception when calling AuthorizationApi->get_products: #{e}"
end
~~~
### Parameters
This endpoint does not need any parameter.
{: class="table table-striped"}
### Return type
[**OrganizationProductEntityListing**](OrganizationProductEntityListing.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**OrganizationRoleEntityListing**](OrganizationRoleEntityListing.html) get_roles(opts)
Retrieve a list of all roles defined for the organization
### 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::AuthorizationApi.new
opts = {
page_size: 25, # Integer | The total page size requested
page_number: 1, # Integer | The page number requested
sort_by: "sort_by_example", # String | variable name requested to sort by
expand: ["expand_example"], # Array | variable name requested by expand list
next_page: "next_page_example", # String | next page token
previous_page: "previous_page_example", # String | Previous page token
permission: ["permission_example"], # Array |
user_count: true # BOOLEAN |
}
begin
#Retrieve a list of all roles defined for the organization
result = api_instance.get_roles(opts)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling AuthorizationApi->get_roles: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**page_size** | **Integer**| The total page size requested | [optional] [default to 25]
**page_number** | **Integer**| The page number requested | [optional] [default to 1]
**sort_by** | **String**| variable name requested to sort by | [optional]
**expand** | [**Array<String>**](String.html)| variable name requested by expand list | [optional]
**next_page** | **String**| next page token | [optional]
**previous_page** | **String**| Previous page token | [optional]
**permission** | [**Array<String>**](String.html)| | [optional]
**user_count** | **BOOLEAN**| | [optional] [default to true]
{: class="table table-striped"}
### Return type
[**OrganizationRoleEntityListing**](OrganizationRoleEntityListing.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**DomainOrgRoleDifference**](DomainOrgRoleDifference.html) get_roles_leftrole_id_comparedefault_rightrole_id(left_role_id, right_role_id)
Get an org role to default role comparison comparison
Compares any organization role to a default role id and show differences
### 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::AuthorizationApi.new
left_role_id = "left_role_id_example" # String | Left Role ID
right_role_id = "right_role_id_example" # String | Right Role id
begin
#Get an org role to default role comparison comparison
result = api_instance.get_roles_leftrole_id_comparedefault_rightrole_id(left_role_id, right_role_id)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling AuthorizationApi->get_roles_leftrole_id_comparedefault_rightrole_id: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**left_role_id** | **String**| Left Role ID |
**right_role_id** | **String**| Right Role id |
{: class="table table-striped"}
### Return type
[**DomainOrgRoleDifference**](DomainOrgRoleDifference.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**DomainOrganizationRole**](DomainOrganizationRole.html) get_roles_role_id(role_id)
Get a single organization role.
Get the organization role specified by its ID.
### 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::AuthorizationApi.new
role_id = "role_id_example" # String | Role ID
begin
#Get a single organization role.
result = api_instance.get_roles_role_id(role_id)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling AuthorizationApi->get_roles_role_id: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**role_id** | **String**| Role ID |
{: class="table table-striped"}
### Return type
[**DomainOrganizationRole**](DomainOrganizationRole.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**UserAuthorization**](UserAuthorization.html) get_user_id_roles(user_id)
Returns a listing of roles and permissions for a user.
### 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::AuthorizationApi.new
user_id = "user_id_example" # String | User ID
begin
#Returns a listing of roles and permissions for a user.
result = api_instance.get_user_id_roles(user_id)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling AuthorizationApi->get_user_id_roles: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**user_id** | **String**| User ID |
{: class="table table-striped"}
### Return type
[**UserAuthorization**](UserAuthorization.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**DomainOrganizationRole**](DomainOrganizationRole.html) patch_roles_role_id(role_id, opts)
Patch Organization Role for needsUpdate Field
Patch Organization Role for needsUpdate Field
### 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::AuthorizationApi.new
role_id = "role_id_example" # String | Role ID
opts = {
body: PureCloud::DomainOrganizationRole.new # DomainOrganizationRole |
}
begin
#Patch Organization Role for needsUpdate Field
result = api_instance.patch_roles_role_id(role_id, opts)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling AuthorizationApi->patch_roles_role_id: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**role_id** | **String**| Role ID |
**body** | [**DomainOrganizationRole**](DomainOrganizationRole.html)| | [optional]
{: class="table table-striped"}
### Return type
[**DomainOrganizationRole**](DomainOrganizationRole.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**DomainOrganizationRole**](DomainOrganizationRole.html) post_roles(opts)
Create an organization role.
### 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::AuthorizationApi.new
opts = {
body: PureCloud::DomainOrganizationRole.new # DomainOrganizationRole |
}
begin
#Create an organization role.
result = api_instance.post_roles(opts)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling AuthorizationApi->post_roles: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**DomainOrganizationRole**](DomainOrganizationRole.html)| | [optional]
{: class="table table-striped"}
### Return type
[**DomainOrganizationRole**](DomainOrganizationRole.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**OrganizationRoleEntityListing**](OrganizationRoleEntityListing.html) post_roles_default(opts)
Restores all default roles
This endpoint serves several purposes. 1. It provides the org with default roles. This is important for default roles that will be added after go-live (they can retroactively add the new default-role). Note: When not using a query param of force=true, it only adds the default roles not configured for the org; it does not overwrite roles. 2. Using the query param force=true, you can restore all default roles. Note: This does not have an effect on custom roles.
### 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::AuthorizationApi.new
opts = {
force: false # BOOLEAN | Restore default roles
}
begin
#Restores all default roles
result = api_instance.post_roles_default(opts)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling AuthorizationApi->post_roles_default: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**force** | **BOOLEAN**| Restore default roles | [optional] [default to false]
{: class="table table-striped"}
### Return type
[**OrganizationRoleEntityListing**](OrganizationRoleEntityListing.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**DomainOrgRoleDifference**](DomainOrgRoleDifference.html) post_roles_leftrole_id_comparedefault_rightrole_id(left_role_id, right_role_id, opts)
Get an unsaved org role to default role comparison
Allows users to compare their existing roles in an unsaved state to its default role
### 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::AuthorizationApi.new
left_role_id = "left_role_id_example" # String | Left Role ID
right_role_id = "right_role_id_example" # String | Right Role id
opts = {
body: PureCloud::DomainOrganizationRole.new # DomainOrganizationRole |
}
begin
# Get an unsaved org role to default role comparison
result = api_instance.post_roles_leftrole_id_comparedefault_rightrole_id(left_role_id, right_role_id, opts)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling AuthorizationApi->post_roles_leftrole_id_comparedefault_rightrole_id: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**left_role_id** | **String**| Left Role ID |
**right_role_id** | **String**| Right Role id |
**body** | [**DomainOrganizationRole**](DomainOrganizationRole.html)| | [optional]
{: class="table table-striped"}
### Return type
[**DomainOrgRoleDifference**](DomainOrgRoleDifference.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**OrganizationRoleEntityListing**](OrganizationRoleEntityListing.html) put_roles_default(opts)
Restore specified default roles
### 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::AuthorizationApi.new
opts = {
body: [PureCloud::DomainOrganizationRole.new] # Array |
}
begin
#Restore specified default roles
result = api_instance.put_roles_default(opts)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling AuthorizationApi->put_roles_default: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**Array<DomainOrganizationRole>**](DomainOrganizationRole.html)| | [optional]
{: class="table table-striped"}
### Return type
[**OrganizationRoleEntityListing**](OrganizationRoleEntityListing.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**DomainOrganizationRole**](DomainOrganizationRole.html) put_roles_role_id(role_id, opts)
Update an organization role.
Update
### 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::AuthorizationApi.new
role_id = "role_id_example" # String | Role ID
opts = {
body: PureCloud::DomainOrganizationRole.new # DomainOrganizationRole |
}
begin
#Update an organization role.
result = api_instance.put_roles_role_id(role_id, opts)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling AuthorizationApi->put_roles_role_id: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**role_id** | **String**| Role ID |
**body** | [**DomainOrganizationRole**](DomainOrganizationRole.html)| | [optional]
{: class="table table-striped"}
### Return type
[**DomainOrganizationRole**](DomainOrganizationRole.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -Array<String>** put_roles_role_id_users_add(role_id, opts)
Sets the users for the role
### 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::AuthorizationApi.new
role_id = "role_id_example" # String | Role ID
opts = {
body: [PureCloud::Array.new] # Array |
}
begin
#Sets the users for the role
result = api_instance.put_roles_role_id_users_add(role_id, opts)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling AuthorizationApi->put_roles_role_id_users_add: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**role_id** | **String**| Role ID |
**body** | **Array<String>**| | [optional]
{: class="table table-striped"}
### Return type
**Array<String>**
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -Array<String>** put_roles_role_id_users_remove(role_id, opts)
Removes the users from the role
### 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::AuthorizationApi.new
role_id = "role_id_example" # String | Role ID
opts = {
body: [PureCloud::Array.new] # Array |
}
begin
#Removes the users from the role
result = api_instance.put_roles_role_id_users_remove(role_id, opts)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling AuthorizationApi->put_roles_role_id_users_remove: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**role_id** | **String**| Role ID |
**body** | **Array<String>**| | [optional]
{: class="table table-striped"}
### Return type
**Array<String>**
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**UserAuthorization**](UserAuthorization.html) put_user_id_roles(user_id, opts)
Sets the user's roles
### 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::AuthorizationApi.new
user_id = "user_id_example" # String | User ID
opts = {
body: [PureCloud::Array.new] # Array |
}
begin
#Sets the user's roles
result = api_instance.put_user_id_roles(user_id, opts)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling AuthorizationApi->put_user_id_roles: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**user_id** | **String**| User ID |
**body** | **Array<String>**| | [optional]
{: class="table table-striped"}
### Return type
[**UserAuthorization**](UserAuthorization.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json