---
title: WorkforceManagementApi
---
## PureCloud::WorkforceManagementApi
All URIs are relative to *https://api.mypurecloud.com*
Method | Description
------------- | ------------- | -------------
[**get_adherence**](WorkforceManagementApi.html#get_adherence) | Get a list of UserScheduleAdherence records for the requested users
[**get_decisions_downloads_download_id**](WorkforceManagementApi.html#get_decisions_downloads_download_id) | Get decisions download link
[**get_managementunits_mu_id_activitycodes**](WorkforceManagementApi.html#get_managementunits_mu_id_activitycodes) | Get activity codes corresponding to a management unit
[**get_managementunits_mu_id_users**](WorkforceManagementApi.html#get_managementunits_mu_id_users) | Get agents in the management unit
[**get_managementunits_mu_id_users_user_id_timeoffrequests**](WorkforceManagementApi.html#get_managementunits_mu_id_users_user_id_timeoffrequests) | Get a list of time off requests for any user
[**get_managementunits_mu_id_users_user_id_timeoffrequests_timeoffrequest_id**](WorkforceManagementApi.html#get_managementunits_mu_id_users_user_id_timeoffrequests_timeoffrequest_id) | Get a time off request by id
[**get_timeoffrequests**](WorkforceManagementApi.html#get_timeoffrequests) | Get a list of time off requests for the current user
[**get_timeoffrequests_timeoffrequest_id**](WorkforceManagementApi.html#get_timeoffrequests_timeoffrequest_id) | Get a time off request for the current user by id
[**patch_timeoffrequests_timeoffrequest_id**](WorkforceManagementApi.html#patch_timeoffrequests_timeoffrequest_id) | Mark a time off request for the current user as read or unread
[**post_decisions_downloads_search**](WorkforceManagementApi.html#post_decisions_downloads_search) | Download decisions files metadata
[**post_longtermforecasts**](WorkforceManagementApi.html#post_longtermforecasts) | Create a forecast
[**post_managementunits_mu_id_schedules_search**](WorkforceManagementApi.html#post_managementunits_mu_id_schedules_search) | Get user schedules within the given time range
[**post_schedules**](WorkforceManagementApi.html#post_schedules) | Get a schedule for the current user
{: class="table table-striped"}
## -[**Array<UserScheduleAdherence>**](UserScheduleAdherence.html) get_adherence(user_id)
Get a list of UserScheduleAdherence records for the requested users
Wraps GET /api/v2/workforcemanagement/adherence
### 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::WorkforceManagementApi.new
user_id = ["user_id_example"] # Array | User Id(s) for which to fetch current schedule adherence information. Min 1, Max of 100 userIds per request
begin
#Get a list of UserScheduleAdherence records for the requested users
result = api_instance.get_adherence(user_id)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling WorkforceManagementApi->get_adherence: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**user_id** | [**Array<String>**](String.html)| User Id(s) for which to fetch current schedule adherence information. Min 1, Max of 100 userIds per request |
{: class="table table-striped"}
### Return type
[**Array<UserScheduleAdherence>**](UserScheduleAdherence.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**DecisionsDownloadLink**](DecisionsDownloadLink.html) get_decisions_downloads_download_id(download_id, opts)
Get decisions download link
Wraps GET /api/v2/workforcemanagement/decisions/downloads/{downloadId}
### 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::WorkforceManagementApi.new
download_id = "download_id_example" # String | The decisions file download id
opts = {
downloadfilename: "downloadfilename" # String | The file name used to get the download url
}
begin
#Get decisions download link
result = api_instance.get_decisions_downloads_download_id(download_id, opts)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling WorkforceManagementApi->get_decisions_downloads_download_id: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**download_id** | **String**| The decisions file download id |
**downloadfilename** | **String**| The file name used to get the download url | [optional] [default to downloadfilename]
{: class="table table-striped"}
### Return type
[**DecisionsDownloadLink**](DecisionsDownloadLink.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**ActivityCodeContainer**](ActivityCodeContainer.html) get_managementunits_mu_id_activitycodes(mu_id)
Get activity codes corresponding to a management unit
Wraps GET /api/v2/workforcemanagement/managementunits/{muId}/activitycodes
### 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::WorkforceManagementApi.new
mu_id = "mu_id_example" # String | The muId of the management unit.
begin
#Get activity codes corresponding to a management unit
result = api_instance.get_managementunits_mu_id_activitycodes(mu_id)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling WorkforceManagementApi->get_managementunits_mu_id_activitycodes: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**mu_id** | **String**| The muId of the management unit. |
{: class="table table-striped"}
### Return type
[**ActivityCodeContainer**](ActivityCodeContainer.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**WfmUserEntityListing**](WfmUserEntityListing.html) get_managementunits_mu_id_users(mu_id)
Get agents in the management unit
Wraps GET /api/v2/workforcemanagement/managementunits/{muId}/users
### 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::WorkforceManagementApi.new
mu_id = "mu_id_example" # String | The muId of the management unit.
begin
#Get agents in the management unit
result = api_instance.get_managementunits_mu_id_users(mu_id)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling WorkforceManagementApi->get_managementunits_mu_id_users: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**mu_id** | **String**| The muId of the management unit. |
{: class="table table-striped"}
### Return type
[**WfmUserEntityListing**](WfmUserEntityListing.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**TimeOffRequestList**](TimeOffRequestList.html) get_managementunits_mu_id_users_user_id_timeoffrequests(mu_id, user_id, opts)
Get a list of time off requests for any user
Wraps GET /api/v2/workforcemanagement/managementunits/{muId}/users/{userId}/timeoffrequests
### 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::WorkforceManagementApi.new
mu_id = "mu_id_example" # String | The muId of the management unit.
user_id = "user_id_example" # String | The userId to whom the Time Off Request applies.
opts = {
recently_reviewed: false # BOOLEAN | Limit results to requests that have been reviewed within the preceding 30 days
}
begin
#Get a list of time off requests for any user
result = api_instance.get_managementunits_mu_id_users_user_id_timeoffrequests(mu_id, user_id, opts)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling WorkforceManagementApi->get_managementunits_mu_id_users_user_id_timeoffrequests: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**mu_id** | **String**| The muId of the management unit. |
**user_id** | **String**| The userId to whom the Time Off Request applies. |
**recently_reviewed** | **BOOLEAN**| Limit results to requests that have been reviewed within the preceding 30 days | [optional] [default to false]
{: class="table table-striped"}
### Return type
[**TimeOffRequestList**](TimeOffRequestList.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**TimeOffRequest**](TimeOffRequest.html) get_managementunits_mu_id_users_user_id_timeoffrequests_timeoffrequest_id(mu_id, user_id, time_off_request_id)
Get a time off request by id
Wraps GET /api/v2/workforcemanagement/managementunits/{muId}/users/{userId}/timeoffrequests/{timeOffRequestId}
### 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::WorkforceManagementApi.new
mu_id = "mu_id_example" # String | The muId of the management unit.
user_id = "user_id_example" # String | The userId to whom the Time Off Request applies.
time_off_request_id = "time_off_request_id_example" # String | Time Off Request Id
begin
#Get a time off request by id
result = api_instance.get_managementunits_mu_id_users_user_id_timeoffrequests_timeoffrequest_id(mu_id, user_id, time_off_request_id)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling WorkforceManagementApi->get_managementunits_mu_id_users_user_id_timeoffrequests_timeoffrequest_id: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**mu_id** | **String**| The muId of the management unit. |
**user_id** | **String**| The userId to whom the Time Off Request applies. |
**time_off_request_id** | **String**| Time Off Request Id |
{: class="table table-striped"}
### Return type
[**TimeOffRequest**](TimeOffRequest.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**TimeOffRequestList**](TimeOffRequestList.html) get_timeoffrequests(opts)
Get a list of time off requests for the current user
Wraps GET /api/v2/workforcemanagement/timeoffrequests
### 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::WorkforceManagementApi.new
opts = {
recently_reviewed: false # BOOLEAN | Limit results to requests that have been reviewed within the preceding 30 days
}
begin
#Get a list of time off requests for the current user
result = api_instance.get_timeoffrequests(opts)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling WorkforceManagementApi->get_timeoffrequests: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**recently_reviewed** | **BOOLEAN**| Limit results to requests that have been reviewed within the preceding 30 days | [optional] [default to false]
{: class="table table-striped"}
### Return type
[**TimeOffRequestList**](TimeOffRequestList.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**TimeOffRequest**](TimeOffRequest.html) get_timeoffrequests_timeoffrequest_id(time_off_request_id)
Get a time off request for the current user by id
Wraps GET /api/v2/workforcemanagement/timeoffrequests/{timeOffRequestId}
### 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::WorkforceManagementApi.new
time_off_request_id = "time_off_request_id_example" # String | Time Off Request Id
begin
#Get a time off request for the current user by id
result = api_instance.get_timeoffrequests_timeoffrequest_id(time_off_request_id)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling WorkforceManagementApi->get_timeoffrequests_timeoffrequest_id: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**time_off_request_id** | **String**| Time Off Request Id |
{: class="table table-striped"}
### Return type
[**TimeOffRequest**](TimeOffRequest.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## - patch_timeoffrequests_timeoffrequest_id(time_off_request_id, opts)
Mark a time off request for the current user as read or unread
Wraps PATCH /api/v2/workforcemanagement/timeoffrequests/{timeOffRequestId}
### 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::WorkforceManagementApi.new
time_off_request_id = "time_off_request_id_example" # String | Time Off Request Id
opts = {
body: PureCloud::TimeOffRequestPatch.new # TimeOffRequestPatch |
}
begin
#Mark a time off request for the current user as read or unread
api_instance.patch_timeoffrequests_timeoffrequest_id(time_off_request_id, opts)
rescue PureCloud::ApiError => e
puts "Exception when calling WorkforceManagementApi->patch_timeoffrequests_timeoffrequest_id: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**time_off_request_id** | **String**| Time Off Request Id |
**body** | [**TimeOffRequestPatch**](TimeOffRequestPatch.html)| | [optional]
{: class="table table-striped"}
### Return type
nil (empty response body)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**DecisionsFileMetadataEntityListing**](DecisionsFileMetadataEntityListing.html) post_decisions_downloads_search(body)
Download decisions files metadata
Wraps POST /api/v2/workforcemanagement/decisions/downloads/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::WorkforceManagementApi.new
body = PureCloud::ForecastSearchRequest.new # ForecastSearchRequest |
begin
#Download decisions files metadata
result = api_instance.post_decisions_downloads_search(body)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling WorkforceManagementApi->post_decisions_downloads_search: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**ForecastSearchRequest**](ForecastSearchRequest.html)| |
{: class="table table-striped"}
### Return type
[**DecisionsFileMetadataEntityListing**](DecisionsFileMetadataEntityListing.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**ForecastCreationCompletion**](ForecastCreationCompletion.html) post_longtermforecasts(body)
Create a forecast
Wraps POST /api/v2/workforcemanagement/longtermforecasts
### 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::WorkforceManagementApi.new
body = PureCloud::ForecastCreation.new # ForecastCreation | The request body
begin
#Create a forecast
result = api_instance.post_longtermforecasts(body)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling WorkforceManagementApi->post_longtermforecasts: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**ForecastCreation**](ForecastCreation.html)| The request body |
{: class="table table-striped"}
### Return type
[**ForecastCreationCompletion**](ForecastCreationCompletion.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**UserScheduleContainer**](UserScheduleContainer.html) post_managementunits_mu_id_schedules_search(mu_id, opts)
Get user schedules within the given time range
Wraps POST /api/v2/workforcemanagement/managementunits/{muId}/schedules/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::WorkforceManagementApi.new
mu_id = "mu_id_example" # String | The muId of the management unit.
opts = {
body: PureCloud::UserListScheduleRequestBody.new # UserListScheduleRequestBody | body
}
begin
#Get user schedules within the given time range
result = api_instance.post_managementunits_mu_id_schedules_search(mu_id, opts)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling WorkforceManagementApi->post_managementunits_mu_id_schedules_search: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**mu_id** | **String**| The muId of the management unit. |
**body** | [**UserListScheduleRequestBody**](UserListScheduleRequestBody.html)| body | [optional]
{: class="table table-striped"}
### Return type
[**UserScheduleContainer**](UserScheduleContainer.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**UserScheduleContainer**](UserScheduleContainer.html) post_schedules(opts)
Get a schedule for the current user
Wraps POST /api/v2/workforcemanagement/schedules
### 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::WorkforceManagementApi.new
opts = {
body: PureCloud::CurrentUserScheduleRequestBody.new # CurrentUserScheduleRequestBody | body
}
begin
#Get a schedule for the current user
result = api_instance.post_schedules(opts)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling WorkforceManagementApi->post_schedules: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**CurrentUserScheduleRequestBody**](CurrentUserScheduleRequestBody.html)| body | [optional]
{: class="table table-striped"}
### Return type
[**UserScheduleContainer**](UserScheduleContainer.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json