---
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|
|[**post_longtermforecasts**](WorkforceManagementApi.html#post_longtermforecasts) | **POST** /api/v2/workforcemanagement/longtermforecasts | Create a forecast|
{: class="table table-striped"}
## -[**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
## -[**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