Citrix Virtual Apps and Desktops REST APIs

How to delete an application folder in Citrix Virtual Apps and Desktops

Use REST APIs to delete an application folder 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 o delete an application folder

Delete an application folder from your site using any REST API tool

Learn from the following example to delete an application folder within your Citrix Virtual Apps and Desktops site using any REST API tool.

Request

DELETE https://[DdcServerAddress]/cvad/manage/ApplicationFolders/{pathOrId} 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 204 NoContent
citrix-transactionid: 60076c9f...
content-Type: application/json; charset=utf-8
date: "Fri, 11 Dec 2020 08:48:14 GMT"
<!--NeedCopy-->

Delete an application folder from your site using PowerShell

Learn from the following example to delete an application folder within your Citrix Virtual Apps and Desktops site using any PowerShell code.

function DeleteApplicationFolder {
    param (
        [Parameter(Mandatory=$true)]
        [string] $customerid,
        [Parameter(Mandatory=$true)]
        [string] $siteid,
        [Parameter(Mandatory=$true)]
        [string] $pathOrId,
        [Parameter(Mandatory=$true)]
        [string] $bearerToken
    )
    $requestUri = [string]::Format("https://[DdcServerAddress]/cvad/manage/ApplicationFolders/{0}", $pathOrId)
    $headers = @{
        "Accept" = "application/json";
        "Authorization" = "CWSAuth Bearer=$bearerToken";
        "Citrix-CustomerId" = $customerid;
        "Citrix-InstanceId" = $siteid;
    }
    
    $response = Invoke-RestMethod -Uri $requestUri -Method DELETE -Headers $headers 
    return $response
}

$customerId = "customer1"
$siteId = "61603f15-cdf9-4c7f-99ff-91636601a795"
$pathOrId = "56f1cbf3-1cc6-40cd-9c82-c95633ba88bb"
$bearerToken = "ey1.."
$response = DeleteApplicationFolder $customerid $siteid $pathOrId $bearerToken 
<!--NeedCopy-->

Delete an application folder from your site using C# code

Learn from the following example to delete an application folder within your Citrix Virtual Apps and Desktops site using any C# code.

public static async Task<string> DeleteApplicationFolder(
    string customerid,
    string siteid,
    string pathOrId,
    string bearerToken)
{
    var requestUri = string.Format("https://[DdcServerAddress]/cvad/manage/ApplicationFolders/{0}", pathOrId);
    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.DeleteAsync(requestUri);    

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

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

Delete an application folder from your site using Python

Learn from the following example to delete an application folder within your Citrix Virtual Apps and Desktops site using Python.

import requests 

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

    response = requests.delete(request_uri, headers = headers)

    return response.json()
<!--NeedCopy-->
Resources
Citrix Virtual Apps and Desktops REST APIs OpenAPI Specification
Copy Download
How to delete an application folder in Citrix Virtual Apps and Desktops