Citrix Virtual Apps and Desktops REST APIs

How to get delivery groups

Use REST APIs to get to get all delivery groups in your DDC.

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 all delivery groups in your DDC

Get delivery groups in your DDC using any REST API tool

Learn from the following example to get delivery groups in your DDC using any REST API tool.

Request

GET 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
<!--NeedCopy-->

Response

HTTP/1.1 200 OK
citrix-transactionid: 871283e7-14f3-478c-b59d-d3c5712c47ab
content-Length: 521
content-Type: application/json; charset=utf-8
date: "Fri, 25 Sep 2020 07:18:24 GMT"

{
    "Items": [
        {
            "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-->

Get delivery groups in your DDC using PowerShell

Learn from the following example to get delivery groups in your DDC using any PowerShell code.

function GetDeliveryGroups {
    param (
        [Parameter(Mandatory=$true)]
        [string] $customerid,
        [Parameter(Mandatory=$true)]
        [string] $siteid,
        [Parameter(Mandatory=$true)]
        [string] $bearerToken
    )
    $requestUri = "https://[DdcServerAddress]/cvad/manage/DeliveryGroups"
    $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"
$bearerToken = "eyJ..."
$response = GetDeliveryGroups $customerid $siteid $bearerToken 
<!--NeedCopy-->

Get delivery groups in your DDC using C# code

Learn from the following example to get delivery groups in your DDC using any C# code.

public static async Task<string> GetDeliveryGroups(
    string customerid,
    string bearerToken,
    string siteid)
{
    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 response = await client.GetAsync(requestUri);

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

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

Get delivery groups in your DDC using Python

Learn from the following example to get delivery groups in your DDC using Python.

import requests 

def get_delivery_groups(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'
              }

    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 delivery groups