Citrix DaaS REST APIs

How to create an application in Citrix DaaS

Use REST APIs to create an application in your Citrix DaaS (formerly Citrix Virtual Apps and Desktops service) 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 create an application in 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.
  • Make sure the application is installed on one or more VDAs, and get the command line path, icon ready.
  • Invoke the API described in this document from a client host or from the API exploration tab to create an application.

Create an application in your site using any REST API tool

Learn from the following example to create an application in your Citrix DaaS site using any REST API tool.

Request

POST https://api.cloud.com/cvad/manage/Applications 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

{
    "ExistingApplications": [],
    "NewApplications": [
        {
            "Icon": "AAABAAEAEBAAAAAAIABoBAAAFgAAACgAAAAQAAAAIAAAAAEAIAAAAAAAQAQAAAAAAAAAAAAAAAAAAAAAAAD///8B////Af///wH///8BEl8sAx4yFz0+FwFxRB0Ei0EdBIcnEQFjBAEAJf///wH///8B////Af///wH///8B////Af///wH///8BJiwOPTZyM8EulEv/a10h/6pDDP/EWBT/y14W/6VNEfFJIQSZAAAAGf///wH///8B////Af///wH///8BNQ4AXVhSG/cgtVr/KsRg/yvKYP9ecSr/oDMH/7VOEv/YZxv/420c/347C9MJAAAp////Af///wH///8BLhAASWpBD/svpk//MsRf/zvNXf822V3/RbJE/4kqB/+YKAb/ojwM/8JXFv/kbh3/a04d1QQAABn///8BDwgAD2ojAN1HkUH/Lctm/zPNZP85yFz/e3Ml/5RFDf+ZLAT/liYE/5YkBP+fKQb/v0cN/5uJO/8qQCKZ////AToZAWOXLAD/Z5hB/yvhd/9OwVz/qXUd/9BIAP/CRQT/sT4F/6MyBP+VKwX/cFwa/404Cf9liTb/PZhO8w0CASVfIAGrrUAG/6Z0H/+imjj/4HcZ//ZqDP/saQ3/5F8J/9RTB//COwH/eX0m/zXkUP89uT3/MrtG/zaxTv8iGwtjfCUBxYR6Lv/LdCD/7IAr//2GLP/5iS3/+YMn//l3G//xaQ//4lEE/22oOv8y1lD/MsZB/yjAQP8lrkP/KTARh11SHcmefy//6IU+//aZTP/5oFP/9qFU//acTf/3kT3/+oAm//loEP+jiyj/L9FR/yy+P/8hsjT/GqM1/yYuDolFWyO7hqtd/6bGif/DrXP/+61v//i4eP/0s3H/9aZc//iVQv/9fiT/zXcf/0G+TP8rv0L/HLEz/xqaK/8kIAdvOz0RhWfwmP+W/cL/keyv/7rBkP/gvY3/7sGL//a1df/3olj//4k0/6ugQv92izb/mloO/1ZyGf8miST9FwgBMyEKACtjrmX5rfvM/6f3w/+b98D/p9mp/+jGlv/4vIP/+qpm//2SRP+tpE7/U75c/1aPMP81lyr/NE4SuwwAAAP///8BPTcSh5/erv/E+df/0dq2/8betP/0x5z/+r+K//GvcP/0mlL/o6hd/07YcP8gzlD/LYkp9RwLATX///8B////AREAAAdQUy2pt+fD/9by2f/O4MH/8Mmk//29jf/3rnb/6qBk/3nciP8512f/LpE0+ScYBVn///8B////Af///wH///8BFwAABVBFHoukr4r39cSq///Dpv//tpL//Zxz/8+KV/9gulv/OX8w1TUXA0n///8B////Af///wH///8B////Af///wH///8BNRAAL3QsCoWSQCC5nUMfx4RAGMNTTBqrPjEMYy0FAA////8B////Af///wH///8BAAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//w==",
            "ApplicationFolder": "",
            "ApplicationType": "HostedOnDesktop",
            "Name": "app001",
            "PublishedName": "app001",
            "InstalledAppProperties": {
                "CommandLineExecutable": "C:\Program Files\SampleApp\SampleApp.exe",
                "CommandLineArguments": "%**",
                "WorkingDirectory": "C:\Program Files\SampleApp"
            },
            "IncludedUsers": []
        }
    ],
    "ApplicationGroups": [
        "53c23ae7-6bc9-4542-b8fd-1b7d538bad41"
    ]
}
<!--NeedCopy-->

Response

HTTP/1.1 200 OK
citrix-transactionid: f743c772...
content-Length: 1248
content-Type: application/json; charset=utf-8
date: "Thu, 10 Dec 2020 06:20:47 GMT"
<!--NeedCopy-->

Create an application in your site using PowerShell

Learn from the following example to create an application in your Citrix DaaS site using any PowerShell code.

function CreateApplication {
    param (
        [Parameter(Mandatory=$true)]
        [string] $customerid,
        [Parameter(Mandatory=$true)]
        [string] $siteid,
        [Parameter(Mandatory=$true)]
        [string] $bearerToken,
        [Parameter(Mandatory=$true)]
        [string] $applicationModel
    )
    $requestUri = "https://api.cloud.com/cvad/manage/Applications"
    $headers = @{
        "Accept" = "application/json";
        "Content-Type"="application/json";
        "Authorization" = "CWSAuth Bearer=$bearerToken";
        "Citrix-CustomerId" = $customerid;
        "Citrix-InstanceId" = $siteid;
    }

    $response = Invoke-RestMethod -Uri $requestUri -Method POST -Headers $headers -Body $applicationModel 
    return $response
}

$customerId = "customer1"
$siteId = "61603f15-cdf9-4c7f-99ff-91636601a795"
$bearerToken = "ey1.."
$application = @"
{
    "ExistingApplications": [],
    "NewApplications": [
        {
            "Icon": "AAAB..",
            "ApplicationFolder": "",
            "ApplicationType": "HostedOnDesktop",
            "Name": "app001",
            "PublishedName": "app001",
            "InstalledAppProperties": {
                "CommandLineExecutable": "C:\Program Files\SampleApp\SampleApp.exe",
                "CommandLineArguments": "%**",
                "WorkingDirectory": "C:\Program Files\SampleApp"
            },
            "IncludedUsers": []
        }
    ],
    "ApplicationGroups": [
        "53c23ae7-6bc9-4542-b8fd-1b7d538bad41"
    ]
}
"@
$response = CreateApplication $customerid $siteid $bearerToken $application
<!--NeedCopy-->

Create an application in your site using C# code

Learn from the following example to create an application in your Citrix DaaS site C# code.

public static async Task<string> CreateApplication(
    string customerid,
    string siteid,
    string bearerToken,
    AddApplicationsRequestModel model)
{
    var requestUri = "https://api.cloud.com/cvad/manage/Applications";
    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.PostAsync(requestUri, new StringContent(jsonBody, Encoding.UTF8, "application/json"));

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

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

Create an application in your site using Python

Learn from the following example to create an application in your Citrix DaaS site using Python.

import requests 

def create_application(bearerToken, customerid, siteid applicationModel):
    request_uri = "https://api.cloud.com/cvad/manage/Applications"
    headers = {
                'Authorization': 'CWSAuth Bearer=%s' % bearerToken,
                'Citrix-CustomerId': customerid,
                'Citrix-InstanceId': siteid,
                'Content-Type': 'application/json',
                'Accept': 'application/json'
              }
    payload = json.dumps(applicationModel)

    response = requests.post(request_uri, headers = headers, verify = False, data = payload)

    return response.json()
<!--NeedCopy-->
Resources
Citrix DaaS REST APIs OpenAPI Specification
Copy Download
How to create an application in Citrix DaaS