---
title: PresenceApi
---
## PureCloud::PresenceApi
All URIs are relative to *https://api.mypurecloud.com*
Method | HTTP request | Description
------------- | ------------- | -------------
|[**delete_presence_id**](PresenceApi.html#delete_presence_id) | **DELETE** /api/v2/presencedefinitions/{presenceId} | Delete an OrganizationPresence|
|[**get_presence_id**](PresenceApi.html#get_presence_id) | **GET** /api/v2/presencedefinitions/{presenceId} | Get an OrganizationPresence|
|[**get_presencedefinitions**](PresenceApi.html#get_presencedefinitions) | **GET** /api/v2/presencedefinitions | Get an Organization's list of Presences|
|[**get_user_id_presences_source**](PresenceApi.html#get_user_id_presences_source) | **GET** /api/v2/users/{userId}/presences/{source} | Get a user's Presence|
|[**patch_user_id_presences_source**](PresenceApi.html#patch_user_id_presences_source) | **PATCH** /api/v2/users/{userId}/presences/{source} | Patch a user's Presence|
|[**post_presencedefinitions**](PresenceApi.html#post_presencedefinitions) | **POST** /api/v2/presencedefinitions | Create an OrganizationPresence|
|[**put_presence_id**](PresenceApi.html#put_presence_id) | **PUT** /api/v2/presencedefinitions/{presenceId} | Update an OrganizationPresence|
{: class="table table-striped"}
## -[**OrganizationPresence**](OrganizationPresence.html) delete_presence_id(presence_id)
Delete an OrganizationPresence
### 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::PresenceApi.new
presence_id = "presence_id_example" # String | Organization Presence ID
begin
#Delete an OrganizationPresence
result = api_instance.delete_presence_id(presence_id)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling PresenceApi->delete_presence_id: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**presence_id** | **String**| Organization Presence ID |
{: class="table table-striped"}
### Return type
[**OrganizationPresence**](OrganizationPresence.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**OrganizationPresence**](OrganizationPresence.html) get_presence_id(presence_id)
Get an OrganizationPresence
### 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::PresenceApi.new
presence_id = "presence_id_example" # String | Organization Presence ID
begin
#Get an OrganizationPresence
result = api_instance.get_presence_id(presence_id)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling PresenceApi->get_presence_id: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**presence_id** | **String**| Organization Presence ID |
{: class="table table-striped"}
### Return type
[**OrganizationPresence**](OrganizationPresence.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**OrganizationPresenceEntityListing**](OrganizationPresenceEntityListing.html) get_presencedefinitions(opts)
Get an Organization's list of Presences
### 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::PresenceApi.new
opts = {
page_number: 1, # Integer | Page number
page_size: 25 # Integer | Page size
}
begin
#Get an Organization's list of Presences
result = api_instance.get_presencedefinitions(opts)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling PresenceApi->get_presencedefinitions: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**page_number** | **Integer**| Page number | [optional] [default to 1]
**page_size** | **Integer**| Page size | [optional] [default to 25]
{: class="table table-striped"}
### Return type
[**OrganizationPresenceEntityListing**](OrganizationPresenceEntityListing.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**UserPresence**](UserPresence.html) get_user_id_presences_source(user_id, source)
Get a user's Presence
### 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::PresenceApi.new
user_id = "user_id_example" # String | user Id
source = "source_example" # String | source
begin
#Get a user's Presence
result = api_instance.get_user_id_presences_source(user_id, source)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling PresenceApi->get_user_id_presences_source: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**user_id** | **String**| user Id |
**source** | **String**| source |
{: class="table table-striped"}
### Return type
[**UserPresence**](UserPresence.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**UserPresence**](UserPresence.html) patch_user_id_presences_source(user_id, source, opts)
Patch a user's Presence
The presence object can be patched one of three ways. Option 1: Set the 'primary' property to true. This will set the 'source' defined in the path as the user's primary presence source. Option 2: Provide the presenceDefinition value. Option 3: Provide the message value. Option 1 can be combined with Option2 and/or Option 3.
### 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::PresenceApi.new
user_id = "user_id_example" # String | user Id
source = "source_example" # String | source
opts = {
body: PureCloud::UserPresence.new # UserPresence |
}
begin
#Patch a user's Presence
result = api_instance.patch_user_id_presences_source(user_id, source, opts)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling PresenceApi->patch_user_id_presences_source: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**user_id** | **String**| user Id |
**source** | **String**| source |
**body** | [**UserPresence**](UserPresence.html)| | [optional]
{: class="table table-striped"}
### Return type
[**UserPresence**](UserPresence.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**OrganizationPresence**](OrganizationPresence.html) post_presencedefinitions(body)
Create an OrganizationPresence
### 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::PresenceApi.new
body = PureCloud::OrganizationPresence.new # OrganizationPresence | The OrganizationPresence to create
begin
#Create an OrganizationPresence
result = api_instance.post_presencedefinitions(body)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling PresenceApi->post_presencedefinitions: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**body** | [**OrganizationPresence**](OrganizationPresence.html)| The OrganizationPresence to create |
{: class="table table-striped"}
### Return type
[**OrganizationPresence**](OrganizationPresence.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
## -[**OrganizationPresence**](OrganizationPresence.html) put_presence_id(presence_id, body)
Update an OrganizationPresence
### 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::PresenceApi.new
presence_id = "presence_id_example" # String | Organization Presence ID
body = PureCloud::OrganizationPresence.new # OrganizationPresence | The OrganizationPresence to update
begin
#Update an OrganizationPresence
result = api_instance.put_presence_id(presence_id, body)
p result
rescue PureCloud::ApiError => e
puts "Exception when calling PresenceApi->put_presence_id: #{e}"
end
~~~
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**presence_id** | **String**| Organization Presence ID |
**body** | [**OrganizationPresence**](OrganizationPresence.html)| The OrganizationPresence to update |
{: class="table table-striped"}
### Return type
[**OrganizationPresence**](OrganizationPresence.html)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json