How to get all machine catalogs in Citrix DaaS
Use REST APIs to get details of all machine catalogs 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 machine catalogs
- 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. - Invoke the API described in this document from a client host or from the API exploration tab to get all the machine catalogs.
Get all machine catalogs using any REST API tool
Learn from the following example to get all the machine catalogs in your Citrix DaaS site using any REST API tool.
Request
GET https://api.cloud.com/cvad/manage/MachineCatalogs 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 200 OK
citrix-transactionid: e7ef453d-d27c-4e36-8e2b-64e1607e7da8
content-Length: 761
content-Type: application/json; charset=utf-8
date: "Thu, 17 Sep 2020 08:21:37 GMT"
{
"Items": [
{
"Name": "CVAD_APIs_MCS_Catalog",
"Id": "3eeb3230...",
"Uid": 4,
"AllocationType": "Random",
"AssignedCount": 0,
"AvailableAssignedCount": 0,
"AvailableCount": 0,
"AvailableUnassignedCount": 0,
"Description": null,
"IsPowerManaged": true,
"IsRemotePC": false,
"JobsInProgress": null,
"MachineType": "Virtual",
"MinimumFunctionalLevel": "L7_25",
"HasBeenPromoted": false,
"HasBeenPromotedFrom": "Unknown",
"CanRollbackVMImage": false,
"PersistChanges": "Discard",
"ProvisioningScheme": null,
"ProvisioningType": "MCS",
"ProvisioningProgress": {
"IsRunning": true,
"Progress": 16,
"ProgressMessage": "Copying the master image"
},
"PvsAddress": null,
"PvsDomain": null,
"RemotePCEnrollmentScopes": null,
"Scopes": [
{
"Id": "00000000...",
"Uid": null,
"Name": "All",
"Description": null,
"IsBuiltIn": true,
"IsAllScope": true,
"IsTenantScope": false,
"TenantId": null,
"TenantName": null
}
],
"Tenants": null,
"SessionSupport": "MultiSession",
"SharingKind": "Unknown",
"TotalCount": 0,
"IsBroken": false,
"Errors": [],
"Warnings": [],
"UnassignedCount": 0,
"UsedCount": 0,
"Zone": {
"Id": "41e85452...",
"Uid": null,
"Name": "My Resource Location"
}
},
{
"Name": "CVAD_APIs_Physical_MC",
"Id": "87c29b00...",
"Uid": 2,
"AllocationType": "Random",
"AssignedCount": 0,
"AvailableAssignedCount": 0,
"AvailableCount": 3,
"AvailableUnassignedCount": 3,
"Description": null,
"IsPowerManaged": false,
"IsRemotePC": false,
"JobsInProgress": null,
"MachineType": "Physical",
"MinimumFunctionalLevel": "L7_9",
"HasBeenPromoted": false,
"HasBeenPromotedFrom": "Unknown",
"CanRollbackVMImage": false,
"PersistChanges": "OnLocal",
"ProvisioningScheme": null,
"ProvisioningType": "Manual",
"ProvisioningProgress": null,
"PvsAddress": null,
"PvsDomain": null,
"RemotePCEnrollmentScopes": null,
"Scopes": [
{
"Id": "00000000...",
"Uid": null,
"Name": "All",
"Description": null,
"IsBuiltIn": true,
"IsAllScope": true,
"IsTenantScope": false,
"TenantId": null,
"TenantName": null
}
],
"Tenants": null,
"SessionSupport": "MultiSession",
"SharingKind": "Unknown",
"TotalCount": 3,
"IsBroken": false,
"Errors": [],
"Warnings": [],
"UnassignedCount": 0,
"UsedCount": 0,
"Zone": {
"Id": "41e85452...",
"Uid": null,
"Name": "My Resource Location"
}
}
]
}
<!--NeedCopy-->
Get all machine catalogs using PowerShell
Learn from the following example to get all the machine catalogs in your Citrix DaaS site using any PowerShell code.
function GetMachineCatalogs {
param (
[Parameter(Mandatory=$true)]
[string] $customerid,
[Parameter(Mandatory=$true)]
[string] $siteid,
[Parameter(Mandatory=$true)]
[string] $bearerToken
)
$requestUri = "https://api.cloud.com/cvad/manage/MachineCatalogs"
$headers = @{
"Accept" = "application/json";
"Authorization" = "CWSAuth Bearer=$bearerToken";
"Citrix-CustomerId" = $customerid;
"Citrix-InstanceId" = $siteid;
}
$response = Invoke-RestMethod -Uri $requestUri -Method GET -Headers $headers
return $response
}
$customerid = "n2ypkklgy6cv"
$siteid = "12f7438-bf8e-42ba-b1b3-2eb75d098f57"
$bearerToken = "eyJ..."
$response = GetMachineCatalogs $customerid $siteid $bearerToken
<!--NeedCopy-->
Get all machine catalogs using C# code
Learn from the following example to get all the machine catalogs in your Citrix DaaS site using any C# code.
public static async Task<string> GetMachineCatalogs(
string customerid,
string bearerToken,
string siteid)
{
var requestUri = "https://api.cloud.com/cvad/manage/MachineCatalogs";
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.GetAsync(requestUri);
if (response != null)
{
var content = await response.Content.ReadAsStringAsync();
return content;
}
return null;
}
}
<!--NeedCopy-->
Get all machine catalogs using Python
Learn from the following example to get all the machine in your Citrix DaaS site using Python.
import requests
def get_machine_catalogs(bearerToken, customerid, siteid):
request_uri = "https://api.cloud.com/cvad/manage/MachineCatalogs"
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)
return response.json()
<!--NeedCopy-->