Citrix DaaS REST APIs

How to get all policies in a policy set in Citrix DaaS

Use REST APIs to get all policies in a policy set 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 get all policies in a policy set

Get all policies in a policy set in your site using any REST API tool

Learn from the following example to get all policies in a policy set in your Citrix DaaS site using any REST API tool.

Request

GET https://api.cloud.com/cvad/manage/gpo/policies?policySetGuid={policySetGuid} 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

Response

HTTP/1.1 200 OK citrix-transactionid: 58d24ea4... content-Length: 189 content-Type: application/json; charset=utf-8 date: "Thu,02 Nov 2023 08:17:19 GMT" Server: Citrix Systems, Inc. Download { "items": [ { "policySetGuid": "ce682aab...", "policyGuid": "a90cb09c...", "policyName": "P01", "priority": 1, "isEnabled": true, "description": "P01" } ] }

Get all policies in a policy set in your site using PowerShell

Learn from the following example to get all policies in a policy set in your Citrix DaaS site using any PowerShell code.

function GetPoliciesInPolicySet { param ( [Parameter(Mandatory=$true)] [string] $customerid, [Parameter(Mandatory=$true)] [string] $siteid, [Parameter(Mandatory=$true)] [string] $policySetGuid, [Parameter(Mandatory=$true)] [string] $bearerToken ) $requestUri = [string]::Format("https://api.cloud.com/cvad/manage/gpo/policies?policySetGuid={0}", $policySetGuid) $headers = @{ "Accept" = "application/json"; "Authorization" = "CWSAuth Bearer=$bearerToken"; } $response = Invoke-RestMethod -Uri $requestUri -Method GET -Headers $headers return $response } $customerid = "n2ypkklgy6cv" $siteid = "12f7438-bf8e-42ba-b1b3-2eb75d098f57" $bearerToken = "eyJ..." $policySetName = "PS01" $policySets = GetPolicySets $customerid $siteid $bearerToken $policySet = $policySets.Items | Where-Object Name -eq $policySetName if ([string]::IsNullOrEmpty($policySet)) { Write-Output "Policy Set named ${policySetName} does not exist" return } $response = GetPoliciesInPolicySet $customerid $siteid $policySet.policySetGuid $bearerToken

Get all policies in a policy set in your site using C# code

Learn from the following example to get all policies in a policy set in your Citrix DaaS site using any C# code.

public static async Task<string> GetPoliciesInPolicySet( string customerid, string siteid, string policySetGuid, string bearerToken) { var requestUri = string.Format("https://api.cloud.com/cvad/manage/gpo/policies?policySetGuid={0}", policySetGuid); 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.Add("Authorization", $"CWSAuth Bearer={bearerToken}"); var response = await client.GetAsync(requestUri); if (response != null) { var content = await response.Content.ReadAsStringAsync(); return content; } return null; } }

Get all policies in a policy set in your site using Python

Learn from the following example to get all policies in a policy set in your Citrix DaaS site using Python.

import json import requests def get_policies_in_policy_set(bearerToken, customerid, siteid, policySetGuid): request_uri = "https://api.cloud.com/cvad/manage/gpo/policies?policySetGuid={0}".format(policySetGuid) 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, verify = False) return response.json()
Resources
Citrix DaaS REST APIs OpenAPI Specification
Copy Download
How to get all policies in a policy set in Citrix DaaS