Citrix DaaS REST APIs

How to get icons from Citrix DaaS

Use REST APIs to get all or conditional icons from your Citrix DaaS (formerly Citrix Virtual Apps and Desktops service) site. Icons are used for creating applications in the site.

You can specify the desired icon data format to be returned via the iconFormat query parameter. You can also explicitly use the builtIn option to get the system built-in icons or to get the user created icons only. If not specified, both types of icons are returned.

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 icons from Citrix DaaS

  • Read the Get started with Citrix Cloud APIs section to ensure that you have the bearer token.
  • Get siteid from How to get site id API.
  • Invoke the API described in this document from a client host or from the API exploration tab to get icons in the current site.

Get icons from your site using any REST API tool

Learn from the following example to get all or conditional icons from your Citrix DaaS site using any REST API tool.

Request

GET https://api.cloud.com/cvad/manage/icons?iconFormat=image%2fpng;32x32x24&builtIn=false 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: 003a86de-6949-47a6-9fa6-e4fe9a746fc0
content-Length: 8193
content-Type: application/json; charset=utf-8
date: "Mon, 25 Jan 2021 10:33:36 GMT"
Server: Citrix Systems, Inc.

{
    "Items": [
        {
            "Id": "c5755e27-2110-4e1c-a5e2-19804bc153fc",
            "IsBuiltIn": false,
            "FormattedData": "TBqrPjEM...===",
            "RawData": "AAABfx4RA...=="
        }
        ...
    ]
}
<!--NeedCopy-->

Get icons from your site using PowerShell

Learn from the following example to get all or conditional icons from your Citrix DaaS site using any PowerShell code.

function GetIcons {
    param (
        [Parameter(Mandatory=$true)]
        [string] $customerid,
        [Parameter(Mandatory=$true)]
        [string] $siteid,
        [Parameter(Mandatory=$true)]
        [string] $bearerToken,
        [Parameter(Mandatory=$false)]
        [string] $iconFormat,
        [Parameter(Mandatory=$false)]
        [string] $isBuiltIn
    )
    if ($iconFormat -ne "" -and $isBuiltIn -ne "")
    {
        $requestUri = [string]::Format("https://api.cloud.com/cvad/manage/icons?iconFormat={0}&isBuiltIn={1}", $iconFormat, $isBuiltIn)
    }
    elseif ($iconFormat -ne "")
    {
        $requestUri = [string]::Format("https://api.cloud.com/cvad/manage/icons?iconFormat={0}", $iconFormat)
    }
    elseif ($isBuiltIn -ne "")
    {
        $requestUri = [string]::Format("https://api.cloud.com/cvad/manage/icons?isBuiltIn={0}", $isBuiltIn)
    }
    else
    {
        $requestUri = "https://api.cloud.com/cvad/manage/icons"
    }

    $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..."
$iconFormat = "image/png;32x32x24"
$isBuildIn = "false"
$response = GetIcons $customerid $siteid $bearerToken $iconFormat $isBuildIn
<!--NeedCopy-->

Get icons from your site using C# code

Learn from the following example to get all or conditional icons from your Citrix DaaS site using C# code.

public static async Task<string> GetIcons(
    string customerid,
    string siteid,
    string bearerToken
    string? iconFormat,
    bool? isBuiltIn)
{
    var requestUri = "https://api.cloud.com/cvad/manage/icons";
    if(iconFormat != null && isBuiltIn != null)
    {
        requestUri += "?iconFormat=" + iconFormat + "&isBuiltIn=" + isBuiltIn;
    }
    else if (iconFormat != null)
    {
        requestUri += "?iconFormat=" + iconFormat;
    }
    else if (isBuiltIn != null)
    {
        requestUri += "?isBuiltIn=" + isBuiltIn;
    }

    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 icons from your site using Python

Learn from the following example to get all or conditional icons from your Citrix DaaS site using Python.

import requests 

def get_icons(bearerToken, customerid, siteid, icon_format, is_builtin):
    if icon_format and is_builtin:
      request_uri = "https://api.cloud.com/cvad/manage/icons?iconFormat={0}&isBuiltIn={1}".format(icon_format, is_builtin)
    elif icon_format
      request_uri = "https://api.cloud.com/cvad/manage/icons?iconFormat={0}".format(icon_format)
    elif icon_format
      request_uri = "https://api.cloud.com/cvad/manage/icons?isBuiltIn={0}".format(is_builtin)
    else
      request_uri = "https://api.cloud.com/cvad/manage/icons"
    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 icons from Citrix DaaS