---
title: WorkforceManagementApi
---
## PureCloud::WorkforceManagementApi
All URIs are relative to *https://api.mypurecloud.com*
Method | HTTP request | Description
------------- | ------------- | -------------
|[**get_adherence**](WorkforceManagementApi.html#get_adherence) | **GET** /api/v2/workforcemanagement/adherence | Get a list of UserScheduleAdherence records for the requested users|
|[**get_decisions_downloads_download_id**](WorkforceManagementApi.html#get_decisions_downloads_download_id) | **GET** /api/v2/workforcemanagement/decisions/downloads/{downloadId} | Get decisions download link|
|[**get_managementunits_mu_id_users_user_id_timeoffrequests**](WorkforceManagementApi.html#get_managementunits_mu_id_users_user_id_timeoffrequests) | **GET** /api/v2/workforcemanagement/managementunits/{muId}/users/{userId}/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** /api/v2/workforcemanagement/managementunits/{muId}/users/{userId}/timeoffrequests/{timeOffRequestId} | Get a time off request by id|
|[**get_timeoffrequests**](WorkforceManagementApi.html#get_timeoffrequests) | **GET** /api/v2/workforcemanagement/timeoffrequests | Get a list of time off requests for the current user|
|[**get_timeoffrequests_timeoffrequest_id**](WorkforceManagementApi.html#get_timeoffrequests_timeoffrequest_id) | **GET** /api/v2/workforcemanagement/timeoffrequests/{timeOffRequestId} | Get a time off request for the current user by id|
|[**patch_timeoffrequests_timeoffrequest_id**](WorkforceManagementApi.html#patch_timeoffrequests_timeoffrequest_id) | **PATCH** /api/v2/workforcemanagement/timeoffrequests/{timeOffRequestId} | Mark a time off request for the current user as read or unread|
|[**post_decisions_downloads_search**](WorkforceManagementApi.html#post_decisions_downloads_search) | **POST** /api/v2/workforcemanagement/decisions/downloads/search | Download decisions files metadata|
|[**post_longtermforecasts**](WorkforceManagementApi.html#post_longtermforecasts) | **POST** /api/v2/workforcemanagement/longtermforecasts | Create a forecast|
|[**post_schedules**](WorkforceManagementApi.html#post_schedules) | **POST** /api/v2/workforcemanagement/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
### 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
### 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
## -[**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
### 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
### 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
### 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
### 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
### 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
### 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
### 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
## -[**TimeOffRequestList**](TimeOffRequestList.html) post_schedules(opts)
Get a schedule for the current 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::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
[**TimeOffRequestList**](TimeOffRequestList.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json