Session Recording Service REST APIs

How to get a session recordings in Citrix DaaS

Use REST APIs to get a list of session recordings from one or more load-balanced sites. 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

  • Read Get started with Citrix Cloud APIs to ensure that you have obtained the customerId and bearer token.
  • Read the How to get site id section to ensure that you have obtained the corresponding SiteId and ServerId
  • Invoke the API described in this document from a client host or from the API exploration tab to get the site ID and more details.

Get session recordings using any REST API tool

This is an example showing how to access session recordings and more using any REST API tool.

Request

GET https://sessionrecording.apps.cloud.com/api/recordings HTTP/1.1
Accept: application/json
Content-Type: application/json; charset=utf-8
Authorization: CWSAuth bearer=<token-from-prerequisites>
Citrix-CustomerId: loy6oujtu6a4
SiteId: 4e324e87-1716-4414-982c-071bca8d69a0
ServerId: a5894bae-5bc0-9f3a-562b-3e5ae3c5f08b
<!--NeedCopy-->

Response

HTTP/1.1 200 OK
citrix-transactionid: c1d5b5d4...
content-Length: 435
content-Type: application/json; charset=utf-8
date: "Wed, 16 Sep 2020 04:19:10 GMT"

[
    {
        "aAName": "DomainName1",
        "applicationName": "###Desktop",
        "archived": false,
        "archiveNotes": null,
        "archiveTimeUtcTicks": 0,
        "clientAddress": "10.157.24.63",
        "clientEncryption": "Basic",
        "clientName": "WORKSPACE1",
        "clientProductId": 1,
        "clientProductVersion": "22.10.0.21",
        "clientResolution": {},
        "daylightSavings": false,
        "deliveryGroup": "RdsDesktopAndAppGroup",
        "dormantTimeInHours": 0,
        "endTimeTicks": 638161599509600000,
        "endTimeUtcTicks": 638161743509600000,
        "eventCount": 0,
        "farmName": "DELIVERY_GROUP1",
        "fileSize": 71281859,
        "durationToSecondsEstimated": "00:54:28",
        "id": "60669257-3ac1-404b-91d7-ed5e1efa7d87",
        "liveOrDormant": false,
        "loginTimeTicks": 638161567122700000,
        "loginTimeUtcTicks": 638161711122700000,
        "nextFileId": "00000000-0000-0000-0000-000000000000",
        "prevFileId": "00000000-0000-0000-0000-000000000000",
        "serverName": "AWTSVDA-0001",
        "serverId": "a5894bae-5bc0-9f3a-562b-3e5ae3c5f08b",
        "siteId": "4e324e87-1716-4414-982c-071bca8d69a0",
        "sessionName": "ICA-CGP#50",
        "startTimeTicks": 638161566822730000,
        "startTimeUtcTicks": 638161710822730000,
        "userAccountName": "Administrator",
        "zoneName": "",
        "eventOnly": false,
        "srServerName": "Server1",
        "restrictedBy": null,
        "restrictedReason": null,
        "expireTime": "2023-04-04T12:49:43.961Z",
        "hmac": "tNe2Zxo..."
    },
    ...
]
<!--NeedCopy-->

Get session recordings using PowerShell

This is an example showing how to access session recordings and more using PowerShell..

function GetRecordings {
    param (
        [Parameter(Mandatory=$true)]
        [string] $bearerToken,
        [Parameter(Mandatory=$true)]
        [string] $customerId
    )
  
    $requestUri = "https://sessionrecording.apps.cloud.com/api/recordings"

    $headers = @{
        "Accept" = "application/json";
        "Authorization" = "CWSAuth Bearer=$bearerToken";
        "Citrix-CustomerId" = $customerid;
        "ServerId" = "a5894bae-5bc0-9f3a-562b-3e5ae3c5f08b";
        "SiteId" = "4e324e87-1716-4414-982c-071bca8d69a0";
        "ServerId" = $ServerId;
    }

    $response = Invoke-RestMethod -Uri $requestUri -Method GET -Headers $headers 

    return $response
}

$bearerToken = "ey1.."
$customerId = "customer1"
$SiteId = ""
$response = GetMe $bearerToken $customerId 
<!--NeedCopy-->

Get session recordings using C# code

This is an example showing how to get the site ID and more using C# code.

public static async Task<string> GetRecordings(
    string customerid,
    string bearerToken)
{
    var requestUri = "https://sessionrecording.apps.cloud.com/api/recordings";
    
    using (var client = new HttpClient())
    {
        client.DefaultRequestHeaders.Accept.ParseAdd("application/json");
        client.DefaultRequestHeaders.Add("Citrix-CustomerId", customerId);
        client.DefaultRequestHeaders.Add("ServerId", "a5894bae-5bc0-9f3a-562b-3e5ae3c5f08b");
        client.DefaultRequestHeaders.Add("SiteId", "4e324e87-1716-4414-982c-071bca8d69a0");
        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;
    }
}
<!--NeedCopy-->

Get session recordings using Python

This is an example showing how to get the site ID and more using Python.

import requests 

def get_recordings(bearerToken):
    request_uri = "https://sessionrecording.apps.cloud.com/api/recordings"
    headers = {
                'Authorization': 'CWSAuth Bearer=%s' % bearerToken,
                'Citrix-CustomerId': customerid,
                'ServerId': 'a5894bae-5bc0-9f3a-562b-3e5ae3c5f08b',
                'SiteId': '4e324e87-1716-4414-982c-071bca8d69a0',
                'Content-Type': 'application/json',
                'Accept': 'application/json'
              }

    response = requests.get(request_uri, headers = headers)

    return response.json()
<!--NeedCopy-->
Resources
Session Recording Service REST APIs OpenAPI Specification
Copy Download
How to get a session recordings in Citrix DaaS