Citrix Virtual Apps and Desktops REST APIs

How to update an application in Citrix Virtual Apps and Desktops

Use REST APIs to update an application 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 update an application

Update an application in your site using any REST API tool

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

Request

PATCH https://[DdcServerAddress]/cvad/manage/Applications/{nameOrId} 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

{
    "PublishedName": "App001",
    "Name": "App001",
    "ClientFolder": "",
    "ShortcutAddedToDesktop": false,
    "MaxTotalInstances": 0,
    "MaxPerUserInstances": 0,
    "InstalledAppProperties": {
        "CommandLineExecutable": "C:\\Program Files\\Citrix\\Studio\\HelperConsole\\StudioWindowsApp.exe",
        "CommandLineArguments": "%**",
        "WorkingDirectory": "C:\\Program Files\\Citrix\\Studio\\HelperConsole"
    },
    "IconFromClient": false,
    "ShortcutAddedToStartMenu": false,
    "IncludedUserFilterEnabled": false,
    "IncludedUsers": []
}
<!--NeedCopy-->

Response

HTTP/1.1 204 NoContent
citrix-transactionid: c4d1a912-314c-4ccd-a13d-a9b0a4a35e63
content-Length: 202
content-Type: application/json; charset=utf-8
date: "Thu, 10 Dec 2020 07:28:42 GMT"
<!--NeedCopy-->

Update an application in your site using PowerShell

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

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

$customerId = "customer1"
$siteId = "61603f15-cdf9-4c7f-99ff-91636601a795"
$nameOrId = "56f1cbf3-1cc6-40cd-9c82-c95633ba88bb"
$bearerToken = "ey1.."
$body = @"
{
    "PublishedName": "App001",
    "Name": "App001",
    "ClientFolder": "",
    "ShortcutAddedToDesktop": false,
    "MaxTotalInstances": 0,
    "MaxPerUserInstances": 0,
    "InstalledAppProperties": {
        "CommandLineExecutable": "C:\\Program Files\\Citrix\\Studio\\HelperConsole\\StudioWindowsApp.exe",
        "CommandLineArguments": "%**",
        "WorkingDirectory": "C:\\Program Files\\Citrix\\Studio\\HelperConsole"
    },
    "IconFromClient": false,     
    "ShortcutAddedToStartMenu": false,
    "IncludedUserFilterEnabled": false,
    "IncludedUsers": []
}
"@
$response = EditApplication $customerid $siteid $nameOrId $bearerToken $body 
<!--NeedCopy-->

Update an application in your site using C# code

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

public static async Task<string> EditApplication(
    string customerid,
    string siteid,
    string nameOrId,
    string bearerToken,
    AddApplicationsRequestModel model)
{
    var requestUri = string.Format("https://[DdcServerAddress]/cvad/manage/Applications/{0}", 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 jsonBody = JsonConvert.SerializeObject(model, new JsonSerializerSettings
        {
            Converters = new JsonConverter[] { new StringEnumConverter() }
        });

        var response = await client.PatchAsync(requestUri, new StringContent(jsonBody, Encoding.UTF8, "application/json"));

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

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

Update an application in your site using Python

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

import requests 

def edit_application(bearerToken, customerid, siteid, nameOrId):
    request_uri = "https://[DdcServerAddress]/cvad/manage/Applications/{0}".format(nameOrId)
    headers = {
                'Authorization': 'CWSAuth Bearer=%s' % bearerToken,
                'Citrix-CustomerId': customerid,
                'Citrix-InstanceId': siteid,
                'Content-Type': 'application/json',
                'Accept': 'application/json'
              }
    payload = json.dumps({
        "PublishedName": "App001",
        "Name": "App001",
        "ClientFolder": "",
        "ShortcutAddedToDesktop": false,
        "MaxTotalInstances": 0,
        "MaxPerUserInstances": 0,
        "InstalledAppProperties": {
            "CommandLineExecutable": "C:\\Program Files\\Citrix\\Studio\\HelperConsole\\StudioWindowsApp.exe",
            "CommandLineArguments": "%**",
            "WorkingDirectory": "C:\\Program Files\\Citrix\\Studio\\HelperConsole"
        },
        "IconFromClient": false,
        "ShortcutAddedToStartMenu": false,
        "IncludedUserFilterEnabled": false,
        "IncludedUsers": []
    })

    response = requests.patch(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 update an application in Citrix Virtual Apps and Desktops