Citrix Virtual Apps and Desktops REST APIs

How to create a delivery group in Citrix Virtual Apps and Desktops

Use REST APIs to create a delivery 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 a delivery group in Citrix Virtual Apps and Desktops

Create a delivery group in Citrix Virtual Apps and Desktops using any REST API tool

Learn from the following example to create a delivery group in your Citrix Virtual Apps and Desktops site using any REST API tool.

Request

POST https://[DdcServerAddress]/cvad/manage/DeliveryGroups 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": "CVAD_APIs_Physical_DG",
    "MachineCatalogs": [
        {
            "MachineCatalog": "87c29b00...",
            "Count": 1,
            "AssignMachinesToUsers": []
        }
    ],
    "DeliveryType": "DesktopsAndApps",
    "Desktops": [
        {
            "Enabled": true,
            "IncludedUserFilterEnabled": true,
            "IncludedUsers": [],
            "PublishedName": "CVAD_APIs_Physical_DG",
            "MaxDesktops": 1
        }
    ],
    "MinimumFunctionalLevel": "L7_25",
    "RequireUserHomeZone": false,
    "SimpleAccessPolicy": {
        "IncludedUsers": [],
        "AllowAnonymous": false,
        "IncludedUserFilterEnabled": false
    },
    "Applications": {
        "ExistingApplications": [],
        "NewApplications": [],
        "ExistingApplicationGroups": []
    },
    "UserManagement": "CloudLibrary",
    "DefaultDesktopPublishedName": "CVAD_APIs_Physical_DG"
}
<!--NeedCopy-->

Response

HTTP/1.1 200 OK
citrix-transactionid: 8705155a...
content-Length: 1248
content-Type: application/json; charset=utf-8
date: "Fri, 25 Sep 2020 06:46:29 GMT"

{
    "AppAccessPolicy": {
        "ExcludedUserFilterEnabled": false,
        "ExcludedUsers": [],
        "IncludedUserFilterEnabled": true,
        "IncludedUsers": [],
        "LeasingBehavior": "Allowed",
        "SessionReconnection": "Always"
    },
    "AutomaticPowerOnForAssigned": false,
    "AutomaticPowerOnForAssignedDuringPeak": false,
    "AutoScaleEnabled": true,
    "ColorDepth": "TwentyFourBit",
    "DefaultDesktopIconId": "1",
    "DefaultDesktopPublishedName": null,
    "DesktopsInUse": 0,
    "DesktopsNeverRegistered": 3,
    "DesktopsPreparing": 0,
    "HdxSslEnabled": null,
    "IsPowerManaged": false,
    "LingerSettings": {
        "Enabled": false,
        "MaxAverageLoadThreshold": 0,
        "MaxLoadPerMachineThreshold": 0,
        "MaxTimeBeforeDisconnectMinutes": 15,
        "MaxTimeBeforeTerminateMinutes": 480,
        "IncludedUserFilterEnabled": false,
        "IncludedUsers": []
    },
    "PowerOffDelayMinutes": 30,
    "MachineCost": 0.0,
    "MachinesInMaintenanceMode": 0,
    "MachineOperatingSystems": [
        {
            "Name": "Unknown",
            "Value": 3
        }
    ],
    "MachineType": "Unknown",
    "OffMachines": 0,
    "OffPeakBufferSizePercent": 10,
    "OffPeakDisconnectAction": "Nothing",
    "OffPeakDisconnectTimeoutMinutes": 0,
    "OffPeakExtendedDisconnectAction": "Nothing",
    "OffPeakExtendedDisconnectTimeoutMinutes": 0,
    "OffPeakLogOffAction": "Nothing",
    "OffPeakLogOffTimeoutMinutes": 0,
    "PeakBufferSizePercent": 10,
    "PeakDisconnectAction": "Nothing",
    "PeakDisconnectTimeoutMinutes": 0,
    "PeakExtendedDisconnectAction": "Nothing",
    "PeakExtendedDisconnectTimeoutMinutes": 0,
    "PeakLogOffAction": "Nothing",
    "PeakLogOffTimeoutMinutes": 0,
    "PrelaunchSettings": {
        "Enabled": false,
        "MaxAverageLoadThreshold": 0,
        "MaxLoadPerMachineThreshold": 0,
        "MaxTimeBeforeDisconnectMinutes": 15,
        "MaxTimeBeforeTerminateMinutes": 120,
        "IncludedUserFilterEnabled": false,
        "IncludedUsers": []
    },
    "PowerTimeSchemes": [],
    "ProtocolPriority": null,
    "RegisteredMachines": 0,
    "ReuseMachinesWithoutShutdownInOutage": false,
    "SecureIcaRequired": false,
    "SettlementPeriodBeforeAutoShutdownSeconds": 0,
    "SettlementPeriodBeforeUseSeconds": 0,
    "ShutdownDesktopsAfterUse": null,
    "SimpleAccessPolicy": {
        "AllowAnonymous": false,
        "AllowHdxAccess": true,
        "AllowMachineRestart": true,
        "AllowRdpAccess": true,
        "ConnectNotViaNetScalerGatewayAllowed": true,
        "ConnectViaNetScalerGatewayAllowed": true,
        "IncludedSmartAccessFilterEnabled": true,
        "IncludedSmartAccessTags": [],
        "IncludedUserFilterEnabled": false,
        "IncludedUsers": []
    },
    "StoreFrontServersForHostedReceiver": [],
    "TimeZone": "UTC",
    "TotalApplicationGroups": 0,
    "TotalMachines": 3,
    "TurnOnAddedMachines": null,
    "UnassignedMachines": null,
    "VdaVersions": [
        {
            "Name": "Unknown",
            "Value": 3
        }
    ],
    "ZonePreferences": [
        "ApplicationHome",
        "UserHome",
        "UserLocation"
    ],
    "Id": "2bece2bc...",
    "Uid": 3,
    "UserManagement": "CloudLibrary",
    "Delivering": "DesktopsOnly",
    "DeliveryType": "DesktopsAndApps",
    "Description": null,
    "DesktopsAvailable": 0,
    "DesktopsDisconnected": 0,
    "DesktopsFaulted": 0,
    "DesktopsUnregistered": 3,
    "Enabled": true,
    "HasBeenPromoted": false,
    "HasBeenPromotedFrom": "Unknown",
    "InMaintenanceMode": false,
    "IsBroken": false,
    "IsRemotePC": false,
    "MinimumFunctionalLevel": "L7_25",
    "Name": "CVAD_APIs_Physical_DG",
    "RequireUserHomeZone": false,
    "Scopes": [
        {
            "Id": "00000000...",
            "Uid": null,
            "Name": "All",
            "Description": null,
            "IsBuiltIn": true,
            "IsAllScope": true,
            "IsTenantScope": false,
            "TenantId": null,
            "TenantName": null
        }
    ],
    "Tenants": null,
    "SessionCount": 0,
    "SessionSupport": "MultiSession",
    "SharingKind": "Shared",
    "TotalApplications": 0,
    "TotalDesktops": 3,
    "ApplicationGroupCompatibility": "Unknown",
    "ApplicationCompatibility": "Unknown",
    "DesktopCompatibility": "Unknown"
}
<!--NeedCopy-->

Create a delivery group in Citrix Virtual Apps and Desktops using PowerShell

Learn from the following example to create a delivery group in your Citrix Virtual Apps and Desktops site using PowerShell code.

function CreateDeliveryGroup {
    param (
        [Parameter(Mandatory=$true)]
        [string] $customerid,
        [Parameter(Mandatory=$true)]
        [string] $siteid,
        [Parameter(Mandatory=$true)]
        [string] $bearerToken,
        [Parameter(Mandatory=$true)]
        [string] $body
    )
    $requestUri = "https://[DdcServerAddress]/cvad/manage/DeliveryGroups"
    $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 $body 
    return $response
}
$customerId = "customer1"
$siteId = "61603f15-cdf9-4c7f-99ff-91636601a795"
$bearerToken = "ey1.."
$body = @"
{
    "Name": "CVAD_APIs_Physical_DG",
    "MachineCatalogs": [
        {
            "MachineCatalog": "87c29b00...",
            "Count": 1,
            "AssignMachinesToUsers": []
        }
    ],
    "DeliveryType": "DesktopsAndApps",
    "Desktops": [
        {
            "Enabled": true,
            "IncludedUserFilterEnabled": true,
            "IncludedUsers": [],
            "PublishedName": "CVAD_APIs_Physical_DG",
            "MaxDesktops": 1
        }
    ],
    "MinimumFunctionalLevel": "L7_25",
    "RequireUserHomeZone": false,
    "SimpleAccessPolicy": {
        "IncludedUsers": [],
        "AllowAnonymous": false,
        "IncludedUserFilterEnabled": false
    },
    "Applications": {
        "ExistingApplications": [],
        "NewApplications": [],
        "ExistingApplicationGroups": []
    },
    "UserManagement": "CloudLibrary",
    "DefaultDesktopPublishedName": "CVAD_APIs_Physical_DG"
}
"@
$response = CreateDeliveryGroup $customerid $siteid $bearerToken $body
<!--NeedCopy-->

Create a delivery group in Citrix Virtual Apps and Desktops using C# code

Learn from the following example to create a delivery group in your Citrix Virtual Apps and Desktops site using C# code.

public static async Task<string> CreateDeliveryGroup(
    string customerid,
    string siteid,
    string bearerToken,
    CreateDeliveryGroupRequestModel model)
{
    var requestUri = "https://[DdcServerAddress]/cvad/manage/DeliveryGroups";
    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 a delivery group in Citrix Virtual Apps and Desktops using Python

Learn from the following example to create a delivery group in your Citrix Virtual Apps and Desktops site using Python.

import requests 

def create_delivery_group(bearerToken, customerid, siteid):
    request_uri = "https://[DdcServerAddress]/cvad/manage/DeliveryGroups"
    headers = {
                'Authorization': 'CWSAuth Bearer=%s' % bearerToken,
                'Citrix-CustomerId': customerid,
                'Citrix-InstanceId': siteid,
                'Content-Type': 'application/json',
                'Accept': 'application/json'
              }
    payload = json.dumps({
        "Name": "CVAD_APIs_Physical_DG",
        "MachineCatalogs": [
            {
                "MachineCatalog": "87c29b00...",
                "Count": 1,
                "AssignMachinesToUsers": []
            }
        ],
        "DeliveryType": "DesktopsAndApps",
        "Desktops": [
            {
                "Enabled": true,
                "IncludedUserFilterEnabled": true,
                "IncludedUsers": [],
                "PublishedName": "CVAD_APIs_Physical_DG",
                "MaxDesktops": 1
            }
        ],
        "MinimumFunctionalLevel": "L7_25",
        "RequireUserHomeZone": false,
        "SimpleAccessPolicy": {
            "IncludedUsers": [],
            "AllowAnonymous": false,
            "IncludedUserFilterEnabled": false
        },
        "Applications": {
            "ExistingApplications": [],
            "NewApplications": [],
            "ExistingApplicationGroups": []
        },
        "UserManagement": "CloudLibrary",
        "DefaultDesktopPublishedName": "CVAD_APIs_Physical_DG"
    })

    response = requests.post(request_uri, headers = headers, verify = False, data = payload)

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