How to get a site ID in Citrix DaaS
Use REST APIs to get details of a site ID in your Citrix DaaS (formerly Citrix Virtual Apps and Desktops service) site. You can also get more details about the currently logged-in admin, including the list of customers and sites that the admin has access to.
Note:
Currently only one site is assigned to your Azure account. The
siteId
can be saved, it will not change as long as the DaaS account remains active.
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 a site ID
- Read the Get started with Citrix Cloud APIs section to ensure that you have the
bearer token
. - Make sure your DDC is power on.
- Invoke the API described in this document from a client host or from the API exploration tab to get the site id and more deails.
Get a site ID using any REST API tool
Learn from the following example to get site ID and more deails using any REST API tool.
Request
GET https://api.cloud.com/cvad/manage/me HTTP/1.1
Accept: application/json
Content-Type: application/json; charset=utf-8
Authorization: CWSAuth bearer=<token-from-prerequisites>
Citrix-CustomerId: loy6oujtu6a4
<!--NeedCopy-->
Response
HTTP/1.1 200 OK
citrix-transactionid: c1d5b5d4...
content-Length: 435
content-Type: application/json; charset=utf-8
date: "Wed, 16 Sep 2020 04:19:10 GMT"
{
"UserId": "9690c023...",
"DisplayName": "John Smith",
"ExpiryTime": "5:19:11 AM",
"RefreshExpirationTime": "4:19:11 PM",
"VerifiedEmail": "john.smith@citrix.com",
"Customers": [
{
"Id": "loy6oujtu6a4",
"Name": null,
"Sites": [
{
"Id": "3061173e...",
"Name": "samplecloudsite"
}
]
}
]
}
<!--NeedCopy-->
Get a site ID using PowerShell
Learn from the following example to get site ID and more deails using any PowerShell code.
function GetMe {
param (
[Parameter(Mandatory=$true)]
[string] $bearerToken,
[Parameter(Mandatory=$true)]
[string] $customerId
)
$requestUri = "https://api.cloud.com/cvad/manage/me"
$headers = @{
"Accept" = "application/json";
"Authorization" = "CWSAuth Bearer=$bearerToken";
"Citrix-CustomerId" = $customerid;
}
$response = Invoke-RestMethod -Uri $requestUri -Method GET -Headers $headers
return $response
}
$bearerToken = "ey1.."
$customerId = "customer1"
$response = GetMe $bearerToken $customerId
<!--NeedCopy-->
Get a site ID using C# code
Learn from the following example to get site ID and more deails using any C# code.
public static async Task<string> GetMe(
string customerid,
string bearerToken)
{
var requestUri = "https://api.cloud.com/cvad/manage/me";
using (var client = new HttpClient())
{
client.DefaultRequestHeaders.Accept.ParseAdd("application/json");
client.DefaultRequestHeaders.Add("Citrix-CustomerId", customerId);
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 a site ID using Python
Learn from the following example to get site ID and more deails using Python.
import requests
def get_me(bearerToken):
request_uri = "https://api.cloud.com/cvad/manage/me"
headers = {
'Authorization': 'CWSAuth Bearer=%s' % bearerToken,
'Citrix-CustomerId': customerid,
'Content-Type': 'application/json',
'Accept': 'application/json'
}
response = requests.get(request_uri, headers = headers)
return response.json()
<!--NeedCopy-->