--- 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 a Presence Definition| |[**get**](PresenceApi.html#get) | **GET** /api/v2/presencedefinitions | Get an Organization's list of Presence Definitions| |[**get_presence_id**](PresenceApi.html#get_presence_id) | **GET** /api/v2/presencedefinitions/{presenceId} | Get a Presence Definition| |[**get_systempresences**](PresenceApi.html#get_systempresences) | **GET** /api/v2/systempresences | Get the list of SystemPresences| |[**get_user_id_presences_source_id**](PresenceApi.html#get_user_id_presences_source_id) | **GET** /api/v2/users/{userId}/presences/{sourceId} | Get a user's Presence| |[**patch_user_id_presences_source_id**](PresenceApi.html#patch_user_id_presences_source_id) | **PATCH** /api/v2/users/{userId}/presences/{sourceId} | Patch a user's Presence| |[**post**](PresenceApi.html#post) | **POST** /api/v2/presencedefinitions | Create a Presence Definition| |[**put_presence_id**](PresenceApi.html#put_presence_id) | **PUT** /api/v2/presencedefinitions/{presenceId} | Update a Presence Definition| {: class="table table-striped"} ## - delete_presence_id(presence_id) Delete a Presence Definition ### 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 a Presence Definition api_instance.delete_presence_id(presence_id) 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 nil (empty response body) ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json ## -[**OrganizationPresenceEntityListing**](OrganizationPresenceEntityListing.html) get(opts) Get an Organization's list of Presence Definitions ### 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 deleted: "false", # String | Deleted query can be TRUE, FALSE or ALL locale_code: "locale_code_example" # String | The locale code to fetch for each presence definition. Use ALL to fetch everything. } begin #Get an Organization's list of Presence Definitions result = api_instance.get(opts) p result rescue PureCloud::ApiError => e puts "Exception when calling PresenceApi->get: #{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] **deleted** | **String**| Deleted query can be TRUE, FALSE or ALL | [optional] [default to false] **locale_code** | **String**| The locale code to fetch for each presence definition. Use ALL to fetch everything. | [optional] {: class="table table-striped"} ### Return type [**OrganizationPresenceEntityListing**](OrganizationPresenceEntityListing.html) ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json ## -[**OrganizationPresence**](OrganizationPresence.html) get_presence_id(presence_id, opts) Get a Presence Definition ### 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 opts = { locale_code: "locale_code_example" # String | The locale code to fetch for the presence definition. Use ALL to fetch everything. } begin #Get a Presence Definition result = api_instance.get_presence_id(presence_id, opts) 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 | **locale_code** | **String**| The locale code to fetch for the presence definition. Use ALL to fetch everything. | [optional] {: class="table table-striped"} ### Return type [**OrganizationPresence**](OrganizationPresence.html) ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json ## -[**Array<SystemPresence>**](SystemPresence.html) get_systempresences Get the list of SystemPresences ### 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 begin #Get the list of SystemPresences result = api_instance.get_systempresences p result rescue PureCloud::ApiError => e puts "Exception when calling PresenceApi->get_systempresences: #{e}" end ~~~ ### Parameters This endpoint does not need any parameter. {: class="table table-striped"} ### Return type [**Array<SystemPresence>**](SystemPresence.html) ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json ## -[**UserPresence**](UserPresence.html) get_user_id_presences_source_id(user_id, source_id) 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_id = "source_id_example" # String | Source begin #Get a user's Presence result = api_instance.get_user_id_presences_source_id(user_id, source_id) p result rescue PureCloud::ApiError => e puts "Exception when calling PresenceApi->get_user_id_presences_source_id: #{e}" end ~~~ ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **user_id** | **String**| user Id | **source_id** | **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_id(user_id, source_id, body) 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. The 'id' is the only value required within the presenceDefinition. Option 3: Provide the message value. Option 1 can be combined with Option 2 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_id = "source_id_example" # String | Source body = PureCloud::UserPresence.new # UserPresence | User presence begin #Patch a user's Presence result = api_instance.patch_user_id_presences_source_id(user_id, source_id, body) p result rescue PureCloud::ApiError => e puts "Exception when calling PresenceApi->patch_user_id_presences_source_id: #{e}" end ~~~ ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **user_id** | **String**| user Id | **source_id** | **String**| Source | **body** | [**UserPresence**](UserPresence.html)| User presence | {: class="table table-striped"} ### Return type [**UserPresence**](UserPresence.html) ### HTTP request headers - **Content-Type**: application/json - **Accept**: application/json ## -[**OrganizationPresence**](OrganizationPresence.html) post(body) Create a Presence Definition ### 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 Presence Definition to create begin #Create a Presence Definition result = api_instance.post(body) p result rescue PureCloud::ApiError => e puts "Exception when calling PresenceApi->post: #{e}" end ~~~ ### Parameters Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **body** | [**OrganizationPresence**](OrganizationPresence.html)| The Presence Definition 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 a Presence Definition ### 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 a Presence Definition 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