---
title: WorkforceManagementApi
---
## PureCloud::WorkforceManagementApi
All URIs are relative to *https://api.mypurecloud.com*
Method | HTTP request | Description
------------- | ------------- | -------------
|[**delete_longtermforecasts_forecast_id**](WorkforceManagementApi.html#delete_longtermforecasts_forecast_id) | **DELETE** /api/v2/workforcemanagement/longtermforecasts/{forecastId} | Delete a forecast|
|[**delete_longtermforecasts_forecast_id_modifications_forecastmodification_id**](WorkforceManagementApi.html#delete_longtermforecasts_forecast_id_modifications_forecastmodification_id) | **DELETE** /api/v2/workforcemanagement/longtermforecasts/{forecastId}/modifications/{forecastModificationId} | Delete a forecast modification|
|[**get_adherence**](WorkforceManagementApi.html#get_adherence) | **GET** /api/v2/workforcemanagement/adherence | Get a list of UserScheduleAdherence records for the requested users|
|[**get_longtermforecasts_forecast_id**](WorkforceManagementApi.html#get_longtermforecasts_forecast_id) | **GET** /api/v2/workforcemanagement/longtermforecasts/{forecastId} | Get forecast|
|[**get_longtermforecasts_forecast_id_modifications**](WorkforceManagementApi.html#get_longtermforecasts_forecast_id_modifications) | **GET** /api/v2/workforcemanagement/longtermforecasts/{forecastId}/modifications | Get forecast Modifications|
|[**post_longtermforecasts**](WorkforceManagementApi.html#post_longtermforecasts) | **POST** /api/v2/workforcemanagement/longtermforecasts | Create a forecast|
|[**post_longtermforecasts_forecast_id_modifications**](WorkforceManagementApi.html#post_longtermforecasts_forecast_id_modifications) | **POST** /api/v2/workforcemanagement/longtermforecasts/{forecastId}/modifications | Create a forecast modification|
|[**post_longtermforecasts_search**](WorkforceManagementApi.html#post_longtermforecasts_search) | **POST** /api/v2/workforcemanagement/longtermforecasts/search | Search forecasts|
|[**put_longtermforecasts_forecast_id_modifications**](WorkforceManagementApi.html#put_longtermforecasts_forecast_id_modifications) | **PUT** /api/v2/workforcemanagement/longtermforecasts/{forecastId}/modifications | Update a forecast modification|
{: class="table table-striped"}
## - delete_longtermforecasts_forecast_id(forecast_id)
Delete 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
forecast_id = "forecast_id_example" # String | The forecast id
begin
#Delete a forecast
api_instance.delete_longtermforecasts_forecast_id(forecast_id)
rescue PureCloud::ApiError => e
puts "Exception when calling WorkforceManagementApi->delete_longtermforecasts_forecast_id: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**forecast_id** | **String**| The forecast id |
{: class="table table-striped"}
### Return type
nil (empty response body)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## - delete_longtermforecasts_forecast_id_modifications_forecastmodification_id(forecast_id, forecast_modification_id)
Delete a forecast modification
### 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
forecast_id = "forecast_id_example" # String | The forecast id
forecast_modification_id = "forecast_modification_id_example" # String | The forecast Modification id
begin
#Delete a forecast modification
api_instance.delete_longtermforecasts_forecast_id_modifications_forecastmodification_id(forecast_id, forecast_modification_id)
rescue PureCloud::ApiError => e
puts "Exception when calling WorkforceManagementApi->delete_longtermforecasts_forecast_id_modifications_forecastmodification_id: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**forecast_id** | **String**| The forecast id |
**forecast_modification_id** | **String**| The forecast Modification id |
{: class="table table-striped"}
### Return type
nil (empty response body)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**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. 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. Max of 100 userIds per request |
{: class="table table-striped"}
### Return type
[**UserScheduleAdherence**](UserScheduleAdherence.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**Forecast**](Forecast.html) get_longtermforecasts_forecast_id(forecast_id)
Get 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
forecast_id = "forecast_id_example" # String | The forecast id
begin
#Get forecast
result = api_instance.get_longtermforecasts_forecast_id(forecast_id)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling WorkforceManagementApi->get_longtermforecasts_forecast_id: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**forecast_id** | **String**| The forecast id |
{: class="table table-striped"}
### Return type
[**Forecast**](Forecast.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**Array<ForecastModification>**](ForecastModification.html) get_longtermforecasts_forecast_id_modifications(forecast_id)
Get forecast Modifications
### 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
forecast_id = "forecast_id_example" # String | The forecast id
begin
#Get forecast Modifications
result = api_instance.get_longtermforecasts_forecast_id_modifications(forecast_id)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling WorkforceManagementApi->get_longtermforecasts_forecast_id_modifications: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**forecast_id** | **String**| The forecast id |
{: class="table table-striped"}
### Return type
[**Array<ForecastModification>**](ForecastModification.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
## -[**ForecastModificationCreation**](ForecastModificationCreation.html) post_longtermforecasts_forecast_id_modifications(forecast_id, body)
Create a forecast modification
### 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
forecast_id = "forecast_id_example" # String | The forecast id
body = PureCloud::ForecastModificationCreation.new # ForecastModificationCreation | The request body
begin
#Create a forecast modification
result = api_instance.post_longtermforecasts_forecast_id_modifications(forecast_id, body)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling WorkforceManagementApi->post_longtermforecasts_forecast_id_modifications: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**forecast_id** | **String**| The forecast id |
**body** | [**ForecastModificationCreation**](ForecastModificationCreation.html)| The request body |
{: class="table table-striped"}
### Return type
[**ForecastModificationCreation**](ForecastModificationCreation.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**ForecastMetadataEntityListing**](ForecastMetadataEntityListing.html) post_longtermforecasts_search(body)
Search forecasts
### 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
#Search forecasts
result = api_instance.post_longtermforecasts_search(body)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling WorkforceManagementApi->post_longtermforecasts_search: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**ForecastSearchRequest**](ForecastSearchRequest.html)| |
{: class="table table-striped"}
### Return type
[**ForecastMetadataEntityListing**](ForecastMetadataEntityListing.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**ForecastModification**](ForecastModification.html) put_longtermforecasts_forecast_id_modifications(forecast_id, body)
Update a forecast modification
### 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
forecast_id = "forecast_id_example" # String | The forecast id
body = PureCloud::ForecastModification.new # ForecastModification | The request body
begin
#Update a forecast modification
result = api_instance.put_longtermforecasts_forecast_id_modifications(forecast_id, body)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling WorkforceManagementApi->put_longtermforecasts_forecast_id_modifications: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**forecast_id** | **String**| The forecast id |
**body** | [**ForecastModification**](ForecastModification.html)| The request body |
{: class="table table-striped"}
### Return type
[**ForecastModification**](ForecastModification.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json