How to get recording status of a session in Citrix DaaS
Use REST APIs to get recording status of a session in your Citrix DaaS (formerly Citrix Virtual Apps and Desktops service) site. Follow the prerequisites and examples to get started with this API. You can make API requests using the PowerShell code, C# code, Python, or any tool that supports invoking the REST API.
Prerequisites to get recording status of a session
- Read the Get started with Citrix Cloud APIs section to ensure that you have the
bearer token
. - Get
siteid
from How to get site id API. - Get
id
of the session to be recorded from How to perform an advanced search for sessions API. - Make sure that
Citrix Connector
has been installed in your domain service. - Install the session recording environment. For more information, see Session Recording
- Invoke the API described in this document from a client host or from the API exploration tab to get recording status of a virtual app or desktop session.
Get recording status of a session using any REST API tool
Learn from the following example to get recording status of a session using any REST API tool.
Session Recording enables IT personnel to monitor and examine user activity. It also supports internal controls for regulatory compliance and security monitoring. Similarly, Session Recording also aids in technical support by speeding problem identification and time-to-resolution.
Response to this Session Recording API is synchronous.
Request to get recording status of a session
Get https://api.cloud.com/cvad/manage/Sessions/RecordingStatus?id=<id-from-prerequisites> HTTP/1.1
Accept: application/json
Content-Type: application/json; charset=utf-8
Authorization: CWSAuth bearer=<token-from-prerequisites>
Citrix-CustomerId: loy6oujtu6a4
Citrix-InstanceId: 22ded57c-0306-47e4-b6e8-fed6252759e1
<!--NeedCopy-->
Response to get recording status of a session
HTTP/1.1 200 OK
citrix-transactionid: da7ee9fb-a2ae-43bf-a03f-3bc6074b6663
content-length: 31
content-type: application/json; charset=utf-8
date: Tue,15 Mar 2022 08:03:47 GMT
{
"IsSessionBeingRecorded": true
}
<!--NeedCopy-->
Get recording status of a session using PowerShell
Learn from the following example to get recording status of a session using any PowerShell code.
function GetRecordingStatus {
param (
[Parameter(Mandatory=$true)]
[string] $customerid,
[Parameter(Mandatory=$true)]
[string] $siteid,
[Parameter(Mandatory=$true)]
[string] $sessionid,
[Parameter(Mandatory=$true)]
[string] $bearerToken
)
$requestUri = [string]::Format("https://api.cloud.com/cvad/manage/Sessions/RecordingStatus?id={0}",$sessionid)
$headers = @{
"Accept" = "application/json";
"Authorization" = "CWSAuth Bearer=$bearerToken";
"Citrix-CustomerId" = $customerid;
"Citrix-InstanceId" = $siteid;
#"id" = $sessionid
}
$response = Invoke-RestMethod -Uri $requestUri -Method Get -Headers $headers
return $response
}
$customerId = "qfutzflgjbec"
$siteId = "4ebd0117-8baf-4ea9-b71e-8ea767158b00"
$sessionId = "bb8ae0fc-edbb-49e5-9e9c-1efdf427ba51"
$bearerToken = "ey..."
$response = GetRecordingStatus $customerid $siteid $sessionId $bearerToken
$isBeingRecorded = $response.IsSessionBeingRecorded
write-host $isBeingRecorded
<!--NeedCopy-->
Get recording status of a session using C# code
Learn from the following example to get recording status of a session using any C# code.
public static async Task<string> GetRecordingStatus(
string customerid,
string siteid,
string bearerToken,
string sessionid)
{
var requestUri = string.Format("https://api.cloud.com/cvad/manage/Sessions/RecordingStatus?id={0}",sessionid);
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Accept.ParseAdd("application/json");
client.DefaultRequestHeaders.Add("Citrix-CustomerId", customerid);
client.DefaultRequestHeaders.Add("Citrix-InstanceId", siteid);
client.DefaultRequestHeaders.Add("User-Agent", "c# App");
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("CwsAuth", "bearer=" + bearerToken);
var response = await client.GetAsync(requestUri);
if (response != null)
{
var content = await response.Content.ReadAsStringAsync();
return content;
}
return null;
}
}
var task = GetRecordingStatus(customerId, siteid, bearerToken, sessionid);
var result = task.Result;
<!--NeedCopy-->
Get recording status of a session using Python
Learn from the following example to get recording status of a session using any Python code.
import requests
def GetRecordingStatus(bearerToken, customerid, sessionid, siteid):
request_uri = "https://api-us.dev.cloud.com/cvad/manage/Sessions/RecordingStatus?id={0}".format(sessionid)
headers = {
'Authorization': 'CWSAuth Bearer=%s' % bearerToken,
'Citrix-CustomerId': customerid,
'Citrix-InstanceId': siteid,
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.get(request_uri, headers = headers)
return response.json()
bearerToken = 'ey...'
customerid = 'qfutzflgjbec'
siteid ='4ebd0117-8baf-4ea9-b71e-8ea767158b00'
sessionid ='bb8ae0fc-edbb-49e5-9e9c-1efdf427ba51'
resp = GetRecordingStatus(bearerToken, customerid, sessionid, siteid)
print(resp)
<!--NeedCopy-->