Citrix Virtual Apps and Desktops REST APIs

How to create an App-V isolation group in Citrix Virtual Apps and Desktops

Use REST APIs to create Microsoft Application Virtualization (App-V) isolation group 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 create an App-V isolation group in Citrix Virtual Apps and Desktops

Create an App-V isolation group using any REST API tool

Learn from the following example to create an App-V isolation group in your Citrix Virtual Apps and Desktops site using any REST API tool.

Request

POST https://[DdcServerAddress]/cvad/manage/appvisolationgroups 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

{
  "Name": "appv-igroup-1",
  "Description": "New Isolation Group 1",
  "IncludedAppVPackages": [
    {
      "ExplicitInclusion": true,
      "Uid": 0
    },
    {
      "ExplicitInclusion": true,
      "Uid": 1
    }
  ]
}
<!--NeedCopy-->

Response

HTTP/1.1 201 Created
citrix-transactionid: f743c772...
content-Length: 0
content-Type: application/json; charset=utf-8
date: "Thu, 10 Dec 2020 06:20:47 GMT"
location: https://[DdcServerAddress]/cvad/manage/appvisolationgroups/1
<!--NeedCopy-->

Create an App-V isolation group using PowerShell code

Learn from the following example to create an App-V isolation group in your Citrix Virtual Apps and Desktops site using any PowerShell code.

function CreateAppVIsolationGroup {
    param (
        [Parameter(Mandatory=$true)]
        [string] $customerid,
        [Parameter(Mandatory=$true)]
        [string] $siteid,
        [Parameter(Mandatory=$true)]
        [string] $bearerToken,
        [Parameter(Mandatory=$true)]
        [string] $igroupModel
    )
    $requestUri = "https://[DdcServerAddress]/cvad/manage/appvisolationgroups"
    $headers = @{
        "Accept" = "application/json";
        "Content-Type"="application/json";
        "Authorization" = "CWSAuth Bearer=$bearerToken";
        "Citrix-CustomerId" = $customerid;
        "Citrix-InstanceId" = $siteid;
    }

    $response = Invoke-RestMethod -Uri $requestUri -Method POST -Headers $headers -Body $igroupModel 
    return $response
}
$customerId = "customer1"
$siteId = "61603f15-cdf9-4c7f-99ff-91636601a795"
$bearerToken = "ey1.."
$igroup = @"
{
  "Name": "appv-igroup-1",
  "Description": "New Isolation Group 1",
  "IncludedAppVPackages": [
    {
      "ExplicitInclusion": true,
      "Uid": 0
    },
    {
      "ExplicitInclusion": true,
      "Uid": 1
    }
  ]
}
"@
$response = CreateAppVIsolationGroup $customerid $siteid $bearerToken $igroup
<!--NeedCopy-->

Create an App-V isolation group using C# code

Learn from the following example to create an App-V isolation group in your Citrix Virtual Apps and Desktops site using C# code.

public static async Task<string> CreateApplication(
    string customerid,
    string siteid,
    string bearerToken,
    AppVIsolationGroupModel model)
{
    var requestUri = "https://[DdcServerAddress]/cvad/manage/appvisolationgroups";
    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 jsonBody = JsonConvert.SerializeObject(model, new JsonSerializerSettings
        {
            Converters = new JsonConverter[] { new StringEnumConverter() }
        });

        var response = await client.PostAsync(requestUri, new StringContent(jsonBody, Encoding.UTF8, "application/json"));

        if (response != null)
        {
            var content = await response.Content.ReadAsStringAsync();
            return content;
        }

        return null;
    }
}
<!--NeedCopy-->

Create an App-V isolation group using Python

Learn from the following example to create an App-V isolation group in your Citrix Virtual Apps and Desktops site using Python.

import requests 

def create_application(bearerToken, customerid, siteid, isolationGroupModel):
    request_uri = "https://[DdcServerAddress]/cvad/manage/appvisolationgroups"
    headers = {
                'Authorization': 'CWSAuth Bearer=%s' % bearerToken,
                'Citrix-CustomerId': customerid,
                'Citrix-InstanceId': siteid,
                'Content-Type': 'application/json',
                'Accept': 'application/json'
              }

    response = requests.post(request_uri, headers = headers, json = isolationGroupModel)

    return response.json()
<!--NeedCopy-->
Resources
Citrix Virtual Apps and Desktops REST APIs OpenAPI Specification
Copy Download
How to create an App-V isolation group in Citrix Virtual Apps and Desktops