Citrix Virtual Apps and Desktops REST APIs

How to get details of the App-V packages from the App-V server in Citrix Virtual Apps and Desktops

Use REST APIs to get details about the Microsoft Application Virtualization (App-V) packages from the App-V server configured within your Citrix Virtual Apps and Desktops 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 details of App-V packages from the App-V server configured in Citrix Virtual Apps and Desktops

Get details of the App-V packages from the App-V server using any REST API tool

Learn from the following example to get details about the App-V packages from the App-V server configured within your Citrix Virtual Apps and Desktops site using any REST API tool.

Request

GET https://[DdcServerAddress]/cvad/manage/appvservers/{server}/packages 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: 06137dc7-193a-41d5-a1a4-317c20f46c85
content-Length: 409
content-Type: application/json; charset=utf-8
date: "Wed, 06 Jan 2021 14:52:44 GMT"
Server: Citrix Systems, Inc.

{
  "Items": [
    {
      "AppVApplications": [
        {
          "Id": "00000000...",
          "Identifier": "null",
          "ServerMachineConfigurationUid": "3abc8a76-34b1-4337-84f8-123c540fdfaa",
          "Name": "sample application",
          "PackageId": "1",
          "PackageName": "sample-pkg1",
          "PackageVersion": "1.0.0.1",
          "PackageVersionId": "fa10f3a3-249b-467e-a8a8-5cc1ef1518e0",
          "PublishingServer": "aps-streaming1.mydomain.net",
          "Uid": 0,
          "BrokerApplicationNames": [
          ]
        }
      ],
      "Description": "Sample App-V package",
      "Exists": true,
      "LibraryUid": 0,
      "LibraryName": "string",
      "LibraryDescription": "string",
      "Name": "sample-pkg1",
      "Id": "1",
      "Path": "string",
      "Uid": 0,
      "Version": "1.0.0.1",
      "VersionGuid": "fa10f3a3-249b-467e-a8a8-5cc1ef1518e0",
      "SourceName": "",
      "SourceType": "Unknown",
      "SourceTypeName": "Unknown",
      "OrderNumber": 0,
      "ExplicitInclusion": true,
      "NumOfBrokerApplications": 0,
      "NumOfBrokerDeliveryGroups": 0
    }
  ],
  "ContinuationToken": null,
  "TotalItems": 1
}
<!--NeedCopy-->

Get details of the App-V packages from the App-V server using PowerShell code

Learn from the following example to get details about the App-V packages from the App-V server configured within your Citrix Virtual Apps and Desktops site using any PowerShell code.

function GetAppVPackagesFromServer {
    param (
        [Parameter(Mandatory=$true)]
        [string] $customerid,
        [Parameter(Mandatory=$true)]
        [string] $siteid,
        [Parameter(Mandatory=$true)]
        [string] $servername,
        [Parameter(Mandatory=$true)]
        [string] $bearerToken
    )
    $requestUri = [string]::Format("https://[DdcServerAddress]/cvad/manage/appvservers/{0}/packages", $servername)
    $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 = "customer1"
$siteid = "61603f15-cdf9-4c7f-99ff-91636601a795"
$bearerToken = "ey1.."
$server = "server1"
$response = GetAppVPackagesFromServer $customerid $siteid $server $bearerToken 
<!--NeedCopy-->

Get details of the App-V packages from the App-V server using C# code

Learn from the following example to get details about the App-V packages from the App-V server configured within your Citrix Virtual Apps and Desktops site using C# code.

public static async Task<string> GetAppVPackagesFromServer(
    string customerid,
    string siteid,
    string servername,
    string bearerToken)
{
    var requestUri = string.Format("https://[DdcServerAddress]/cvad/manage/appvservers/{0}/packages", servername);
    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 details of the App-V packages from the App-V server using Python

Learn from the following example to get details about the App-V packages from the App-V server configured within your Citrix Virtual Apps and Desktops site using Python.

import requests 

def get_appv_packages_from_server(bearerToken, customerid, siteid, servername):
    request_uri = "https://[DdcServerAddress]/cvad/manage/appvservers/{0}/packages".format(servername)
    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 Virtual Apps and Desktops REST APIs OpenAPI Specification
Copy Download
How to get details of the App-V packages from the App-V server in Citrix Virtual Apps and Desktops