Connection data request examples
Connection represents an initial connection or reconnect for a session.
Use Citrix Monitor Service API to get the details of connection.
NOTE: The request examples of this section target cloud setups. However the OData queries also apply to on-premises setups. Simply adjust the request URL to be of the form
http[s]://{MonitorServiceHost}/Citrix/Monitor/OData/v4/Data/{ODataQuery}
and change the authentication to NTLM.
Prerequisites
- Read the Get started with Citrix Cloud APIs section to ensure that you have a valid
bearer token
. - Use the endpoint
https://{ApiGatewayEndpoint}/monitorodata/Connections
for your requests. See Supported API Gateway endpoints for a list of region specific API gateway endpoints. - Invoke the API described in this document from a client host.
Connection details for sessions with failure
- Use
$expand
operation to get the details for sessions with failure.
Request
/monitorodata/Connections?$filter=Session/FailureDate ge 2024-07-24T00:00:00.000Z and Session/FailureDate le 2024-07-25T00:00:00.000Z &$select=*,&$expand=Session($select=*;$expand=User($select=UPN,UserName),Failure($select=ConnectionFailureEnumValue,Category),Machine($select=DnsName,DesktopGroupId,IsInMaintenanceMode)) HTTP/1.1
Host: api.cloud.com
Authorization: CWSAuth bearer=<Token>
Citrix-CustomerId: <CustomerId>
<!--NeedCopy-->
Response
HTTP/1.1 200 OK
Date: Thu, 01 Aug 2024 06:23:00 GMT
Content-Type: application/json; odata.metadata=minimal
Content-Length: 5506
Connection: keep-alive
odata-version: 4.0
{
"@odata.context": "https://api.cloud.com/monitorodata/$metadata#Connections(*,Session(*,User(Upn,UserName),Failure(ConnectionFailureEnumValue,Category),Machine(DnsName,DesktopGroupId,IsInMaintenanceMode)))",
"value": [
{
"Id": 408601,
"ClientName": "test_s_MacBook_Pr",
"ClientAddress": "192.168.50.144",
"ClientVersion": "22.01.0.9",
"ClientPlatform": "Macintosh",
"ConnectedViaHostName": null,
"ConnectedViaIPAddress": "10.69.78.36",
"LaunchedViaHostName": null,
"LaunchedViaIPAddress": null,
"IsReconnect": false,
"IsSecureIca": false,
"Protocol": "HDX",
"LogOnStartDate": "2022-03-31T07:49:47.307Z",
"LogOnEndDate": "2022-03-31T07:50:00.33Z",
"BrokeringDuration": null,
"BrokeringDate": null,
"DisconnectCode": 0,
"DisconnectDate": "2022-03-31T08:10:51.533Z",
"VMStartStartDate": null,
"VMPoweredOnDate": null,
"VMStartEndDate": null,
"ClientSessionValidateDate": null,
"ServerSessionValidateDate": "2022-03-31T07:49:47.307Z",
"EstablishmentDate": "2022-03-31T07:49:47.307Z",
"HdxStartDate": null,
"HdxEndDate": null,
"AuthenticationDuration": null,
"GpoStartDate": null,
"GpoEndDate": null,
"LogOnScriptsStartDate": null,
"LogOnScriptsEndDate": null,
"ProfileLoadStartDate": null,
"ProfileLoadEndDate": null,
"InteractiveStartDate": null,
"InteractiveEndDate": null,
"SessionKey": "38502302-78ed-4f02-a3f0-cf6a31269b29",
"CreatedDate": "2022-03-31T07:50:00.33Z",
"ModifiedDate": "2022-03-31T08:10:51.533Z",
"Session": {
"SessionKey": "38502302-78ed-4f02-a3f0-cf6a31269b29",
"StartDate": "2022-03-31T07:49:47.307Z",
"LogOnDuration": null,
"EndDate": null,
"ExitCode": 1,
"FailureId": 13,
"FailureDate": "2024-07-24T14:53:56.517Z",
"ConnectionState": 2,
"SessionIdleTime": null,
"ConnectionStateChangeDate": "2022-04-22T07:47:14.63Z",
"LifecycleState": 0,
"CurrentConnectionId": 884385,
"UserId": 1505,
"MachineId": "7ff93079-914a-4e6e-b9fe-5ce6e7578684",
"SessionType": 0,
"IsAnonymous": false,
"PublishedDesktopId": null,
"CreatedDate": "2022-03-31T07:50:00.33Z",
"ModifiedDate": "2022-04-22T07:47:14.63Z",
"User": {
"Upn": "test.test@citrix.com",
"UserName": "test"
},
"Failure": {
"ConnectionFailureEnumValue": 101,
"Category": 2
},
"Machine": {
"DnsName": "test-office.eng.citrite.net",
"IsInMaintenanceMode": false,
"DesktopGroupId": "b62f4949-0756-4a1e-94d9-e70cdfd0a198"
}
}
}
]
}
<!--NeedCopy-->
List of client versions
For the list of the client versions, we can query the Connections entity. We can aggregate over the Client platform and version and calculate the number of clients running each of the versions.
Request
/monitorodata/Connections?$apply=filter(ClientVersion ne null and ClientPlatform ne null)/groupby((ClientPlatform,ClientVersion),aggregate(ClientName with countdistinct as ClientCount)) HTTP/1.1
Host: api.cloud.com
Authorization: CWSAuth bearer=<Token>
Citrix-CustomerId: <CustomerId>
<!--NeedCopy-->
Response
HTTP/1.1 200 OK
Date: Thu, 01 Aug 2024 06:23:00 GMT
Content-Type: application/json; odata.metadata=minimal
Content-Length: 5506
Connection: keep-alive
odata-version: 4.0
{
"@odata.context": "https://api.cloud.com/monitorodata/$metadata#Connections(*,Session(*,User(Upn,UserName),Failure(ConnectionFailureEnumValue,Category),Machine(DnsName,DesktopGroupId,IsInMaintenanceMode)))",
"value": [
{
"@odata.id":null,
"ClientVersion":"24.8.0",
"ClientPlatform":"Android",
"ClientCount":15
},
{
"@odata.id":null,
"ClientVersion":"24.11.0.2065",
"ClientPlatform":"Windows",
"ClientCount":18
}
]
}
<!--NeedCopy-->
Connection data request examples
Copied!
Failed!