Citrix DaaS REST APIs

How to get site objects associated with a tenant

Use REST APIs to get site objects associated with a tenant.

Site objects that can be queried include applications, application groups, delivery groups, desktops, hypervisors, and machine catalogs.

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 site objects associated with a tenant

Get site objects associated with a tenant using any REST API tool

The following example illustrates how to get all delivery groups associated with a tenant.

To get all applications, replace the trailing ‘/deliverygroups’ in the request URL with ‘/applications’.

To get all application groups, replace the trailing ‘/deliverygroups’ in the request URL with ‘/applicationgroups’.

To get all desktops, replace the trailing ‘/deliverygroups’ in the request URL with ‘/desktops’.

To get all hypervisors, replace the trailing ‘/deliverygroups’ in the request URL with ‘/hypervisors’.

To get all machine catalogs, replace the trailing ‘/deliverygroups’ in the request URL with ‘/machinecatalogs’.

Request

GET https://api.cloud.com/cvad/manage/tenants/{nameOrId}/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: ba78d60e-eb03-4e15-83fb-55ee32be61be 
content-Length: 521
content-Type: application/json; charset=utf-8
date: "Fri, 22 Jan 2021 11:35:24 GMT"
Server: Citrix Systems, Inc.

{
    "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 site objects associated with a tenant using PowerShell

Learn from the following example to get site objects associated with a tenant using any PowerShell code.

function GetTenantDeliveryGroups {
    param (
        [Parameter(Mandatory=$true)]
        [string] $customerid,
        [Parameter(Mandatory=$true)]
        [string] $siteid,
        [Parameter(Mandatory=$true)]
        [string] $nameOrId,
        [Parameter(Mandatory=$true)]
        [string] $bearerToken
    )
    $requestUri = [string]::Format("https://api.cloud.com/cvad/manage/tenants/{0}/deliverygroups", $nameOrId)
    $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"
$nameOrId = "56f1cbf3-1cc6-40cd-9c82-c95633ba88bb"
$bearerToken = "ey1.."
$response = GetTenantDeliveryGroups $customerid $siteid $nameOrId $bearerToken 
<!--NeedCopy-->

Get site objects associated with a tenant using C# code

Learn from the following example to get site objects associated with a tenant using any C# code.

public static async Task<string> GetTenantDeliveryGroups(
    string customerid,
    string siteid,
    string nameOrId,
    string bearerToken)
{
    var requestUri = string.Format("https://api.cloud.com/cvad/manage/tenants/{0}/deliverygroups", nameOrId);
    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 site objects associated with a tenant using Python

Learn from the following example to get site objects associated with a tenant using Python.

import requests 

def get_tenant_delivery_groups(bearerToken, customerid, siteid, nameOrId):
    request_uri = "https://api.cloud.com/cvad/manage/tenants/{0}/deliverygroups".format(nameOrId)
    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 site objects associated with a tenant