Citrix DaaS REST APIs

How to get configuration operations in Citrix DaaS

Use REST APIs to get logged configuration operations in your Citrix DaaS (formerly Citrix Virtual Apps and Desktops service) site. This enables security auditing and helps to find out the root cause for an unexpected configuration change.

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 configuration operations

  • 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.
  • Invoke the API described in this document from a client host or from the API exploration tab to get logged configuration operations.

Get configuration operations using any REST API tool

Learn from the following example to get the most recent 100 configuration operations that occurred within the last one day using any REST API tool.

For more information about how to specify another search date option or a search string, see the API specification.

For more information about how to perform an advanced search by more criteria, see How to perform an advanced search for operations.

Request

GET https://api.cloud.com/cvad/manage/ConfigLog/Operations?days=1&limit=100 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

HTTP/1.1 200 OK
citrix-transactionid: ce0d3943-e294-4fc8-b2c6-85271d4a0c3b
content-Length: 877
content-Type: application/json; charset=utf-8
date: "Mon, 21 Dec 2020 13:05:41 GMT"
Server: Citrix Systems, Inc.

{
    "Items": [
        {
            "Id": "0d96ecf1-4c73-4a0c-9476-ecbf40289d2b",
            "AdminMachineIP": "",
            "EndTime": "12/21/2020 : 3:21:12 PM",
            "IsSuccessful": true,
            "OperationType": "ConfigurationChange",
            "Parameters": [],
            "Source": "Broker SDK",
            "StartTime": "12/21/2020 : 3:21:12 PM",
            "TargetTypes": [
                "Application"
            ],
            "Text": "Remove Application 'DataExplorer'",
            "User": "jack.smith@example.com"
        },
        {
            "Id": "160bc0d9-48a3-47eb-8012-fee290964017",
            "AdminMachineIP": "",
            "EndTime": "12/21/2020 : 1:48:56 PM",
            "IsSuccessful": true,
            "OperationType": "ConfigurationChange",
            "Parameters": [],
            "Source": "Broker SDK",
            "StartTime": "12/21/2020 : 1:48:56 PM",
            "TargetTypes": [
                "Application"
            ],
            "Text": "Remove Application 'demo'",
            "User": "jack.smith@example.com"
        },
        {
            "Id": "23010325-191a-48a1-b331-ef8488914b08",
            "AdminMachineIP": "",
            "EndTime": "12/21/2020 : 1:48:28 PM",
            "IsSuccessful": true,
            "OperationType": "ConfigurationChange",
            "Parameters": [],
            "Source": "Studio",
            "StartTime": "12/21/2020 : 1:48:27 PM",
            "TargetTypes": null,
            "Text": "Create Application 'DataExplorer'",
            "User": "jack.smith@example.com"
        }
    ],
    "ContinuationToken": "eyJTdGFydGluZ1JlY29yZCI6MywiUmVxdWlyZWRDb3VudCI6MywiQWRkaXRpb25hbERhdGEiOm51bGx9"
}
<!--NeedCopy-->

Get configuration operations using PowerShell

Learn from the following example to get the most recent 100 configuration operations that occurred within the last one day using any PowerShell code.

function GetRecentOperations {
    param (
        [Parameter(Mandatory=$true)]
        [string] $customerid,
        [Parameter(Mandatory=$true)]
        [string] $siteid,
        [Parameter(Mandatory=$false)]
        [int] $days,
        [Parameter(Mandatory=$false)]
        [int] $limit,
        [Parameter(Mandatory=$true)]
        [string] $bearerToken
    )
    if ($days -gt 0 -and $limit -gt 0)
    {
        $requestUri = [string]::Format("https://api.cloud.com/cvad/manage/ConfigLog/Operations?days={0}&limit={1}", $days, $limit)
    }
    elseif ($days -gt 0)
    {
        $requestUri = [string]::Format("https://api.cloud.com/cvad/manage/ConfigLog/Operations?days={0}", $days)
    }
    elseif ($limit -gt 0)
    {
        $requestUri = [string]::Format("https://api.cloud.com/cvad/manage/ConfigLog/Operations?limit={0}", $limit)
    }
    else
    {
        $requestUri = "https://api.cloud.com/cvad/manage/ConfigLog/Operations"
    }

    $headers = @{
        "Accept" = "application/json";
        "Authorization" = "CWSAuth Bearer=$bearerToken";
        "Citrix-CustomerId" = $customerid;
        "Citrix-InstanceId" = $siteid;
    }

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

$customerid = "n2ypkklgy6cv"
$siteid = "12f7438-bf8e-42ba-b1b3-2eb75d098f57"
$days = 1
$limit = 100
$bearerToken = "eyJ..."
$response = GetRecentOperations $customerid $siteid $days $limit $bearerToken
<!--NeedCopy-->

Get configuration operations using C# code

Learn from the following example to get the most recent 100 configuration operations that occurred within the last one day using any C# code.

public static async Task<string> GetRecentOperations(
    string customerid,
    string siteid,
    string bearerToken,
    int? days,
    int? limit)
{
    var requestUri = "https://api.cloud.com/cvad/manage/ConfigLog/Operations";
    if(days != null && limit != null)
    {
        requestUri += "?days=" + days + "&limit=" + limit;
    }
    else if (days != null)
    {
        requestUri += "?days=" + days;
    }
    else if (limit != null)
    {
        requestUri += "?limit=" + limit;
    }

    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.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 configuration operations using Python

Learn from the following example to get the most recent 100 configuration operations that occurred within the last one day using Python.

import requests 

def get_recent_operations(bearerToken, customerid, siteid, days, limit):
    if days > 0 and limit > 0:
      request_uri = "https://api.cloud.com/cvad/manage/ConfigLog/Operations?days={0}&limit={1}".format(days, limit)
    elif days > 0:
      request_uri = "https://api.cloud.com/cvad/manage/ConfigLog/Operations?days={0}".format(days)
    elif limit > 0:
      request_uri = "https://api.cloud.com/cvad/manage/ConfigLog/Operations?limit={0}".format(limit) 
    else
        request_uri = "https://api.cloud.com/cvad/manage/ConfigLog/Operations"

    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()
<!--NeedCopy-->
Resources
Citrix DaaS REST APIs OpenAPI Specification
Copy Download
How to get configuration operations in Citrix DaaS