---
title: AuthorizationApi
---
## PureCloud::AuthorizationApi
All URIs are relative to *https://api.mypurecloud.com*
Method | Description
------------- | ------------- | -------------
[**delete_authorization_role**](AuthorizationApi.html#delete_authorization_role) | Delete an organization role.
[**delete_user_roles**](AuthorizationApi.html#delete_user_roles) | Removes all the roles from the user.
[**get_authorization_permissions**](AuthorizationApi.html#get_authorization_permissions) | Get all permissions.
[**get_authorization_products**](AuthorizationApi.html#get_authorization_products) | Get the list of enabled products
[**get_authorization_role**](AuthorizationApi.html#get_authorization_role) | Get a single organization role.
[**get_authorization_role_comparedefault_right_role_id**](AuthorizationApi.html#get_authorization_role_comparedefault_right_role_id) | Get an org role to default role comparison comparison
[**get_authorization_roles**](AuthorizationApi.html#get_authorization_roles) | Retrieve a list of all roles defined for the organization
[**get_user_roles**](AuthorizationApi.html#get_user_roles) | Returns a listing of roles and permissions for a user.
[**patch_authorization_role**](AuthorizationApi.html#patch_authorization_role) | Patch Organization Role for needsUpdate Field
[**post_authorization_role_comparedefault_right_role_id**](AuthorizationApi.html#post_authorization_role_comparedefault_right_role_id) | Get an unsaved org role to default role comparison
[**post_authorization_roles**](AuthorizationApi.html#post_authorization_roles) | Create an organization role.
[**post_authorization_roles_default**](AuthorizationApi.html#post_authorization_roles_default) | Restores all default roles
[**put_authorization_role**](AuthorizationApi.html#put_authorization_role) | Update an organization role.
[**put_authorization_role_users_add**](AuthorizationApi.html#put_authorization_role_users_add) | Sets the users for the role
[**put_authorization_role_users_remove**](AuthorizationApi.html#put_authorization_role_users_remove) | Removes the users from the role
[**put_authorization_roles_default**](AuthorizationApi.html#put_authorization_roles_default) | Restore specified default roles
[**put_user_roles**](AuthorizationApi.html#put_user_roles) | Sets the user's roles
{: class="table table-striped"}
## - delete_authorization_role(role_id)
Delete an organization role.
Wraps DELETE /api/v2/authorization/roles/{roleId}
### Example
~~~ruby
# load the gem
require 'purecloudplatformclientv2'
# 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_authorization_role(role_id)
rescue PureCloud::ApiError => e
puts "Exception when calling AuthorizationApi->delete_authorization_role: #{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_roles(user_id)
Removes all the roles from the user.
Wraps DELETE /api/v2/users/{userId}/roles
### Example
~~~ruby
# load the gem
require 'purecloudplatformclientv2'
# 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_roles(user_id)
rescue PureCloud::ApiError => e
puts "Exception when calling AuthorizationApi->delete_user_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
## -[**PermissionCollectionEntityListing**](PermissionCollectionEntityListing.html) get_authorization_permissions(opts)
Get all permissions.
Retrieve a list of all permission defined in the system.
Wraps GET /api/v2/authorization/permissions
### Example
~~~ruby
# load the gem
require 'purecloudplatformclientv2'
# 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_authorization_permissions(opts)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling AuthorizationApi->get_authorization_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_authorization_products
Get the list of enabled products
Gets the list of enabled products. Some example product names are: collaborateFree, collaboratePro, communicate, and engage.
Wraps GET /api/v2/authorization/products
### Example
~~~ruby
# load the gem
require 'purecloudplatformclientv2'
# 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_authorization_products
p result
rescue PureCloud::ApiError => e
puts "Exception when calling AuthorizationApi->get_authorization_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
## -[**DomainOrganizationRole**](DomainOrganizationRole.html) get_authorization_role(role_id)
Get a single organization role.
Get the organization role specified by its ID.
Wraps GET /api/v2/authorization/roles/{roleId}
### Example
~~~ruby
# load the gem
require 'purecloudplatformclientv2'
# 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_authorization_role(role_id)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling AuthorizationApi->get_authorization_role: #{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
## -[**DomainOrgRoleDifference**](DomainOrgRoleDifference.html) get_authorization_role_comparedefault_right_role_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
Wraps GET /api/v2/authorization/roles/{leftRoleId}/comparedefault/{rightRoleId}
### Example
~~~ruby
# load the gem
require 'purecloudplatformclientv2'
# 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_authorization_role_comparedefault_right_role_id(left_role_id, right_role_id)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling AuthorizationApi->get_authorization_role_comparedefault_right_role_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
## -[**OrganizationRoleEntityListing**](OrganizationRoleEntityListing.html) get_authorization_roles(opts)
Retrieve a list of all roles defined for the organization
Wraps GET /api/v2/authorization/roles
### Example
~~~ruby
# load the gem
require 'purecloudplatformclientv2'
# 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: nil, # Array