User data request examples

Users represent the users that have launched a session in the site. Use Citrix Monitor Service API to get the details of users.

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

Users of target domain

  • Domain eq 'CITRITE' represents the target domain.

Request

GET /monitorodata/Users?$filter=Domain eq 'CITRITE' 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#Users",
    "value": [
        {
            "Id": 2,
            "Sid": "S-1-5-21-1076320343-3137401123-2908695819-83261",
            "Upn": "matthew.bennett@citrix.com",
            "UserName": "matthewben",
            "FullName": "Matthew Bennett",
            "Domain": "CITRITE",
            "CreatedDate": "2018-12-12T11:30:57.15Z",
            "ModifiedDate": "2021-05-10T12:27:18.223Z"
        },
        {
            "Id": 3,
            "Sid": "S-1-5-21-1076320343-3137401123-2908695819-83263",
            "Upn": "adm1_matthewben@citrix.com",
            "UserName": "adm1_matthewben",
            "FullName": "Matthew Bennett (ADM1)",
            "Domain": "CITRITE",
            "CreatedDate": "2018-12-12T11:34:37.637Z",
            "ModifiedDate": "2021-07-26T15:36:01.04Z"
        }
    ]
}
<!--NeedCopy-->

Users with high logon duration

As part of this example, we query for the Sessions entity, which includes the logon duration values. The logon duration threshold can be adjusted. Session entity provides linking with the Users entity, as well as Machines and Connections, allowing us to enrich the result with such information (e.g. Logon Duration breakdown)

  • StartDate gt 2025-05-01 selects sessions started after the timestamp.
  • LogonDuration gt 120000 selects users with logon duration greater than 120 seconds.
  • Using the $expand operator we enrich the output with Machine, DesktopGroup, User and Connection details.
  • orderby=LogOnDuration desc sorts the results in descending order.

Request

GET /monitorodata/Sessions?$filter=StartDate ge 2025-05-01 and LogonDuration gt 120000 &$expand=Machine($select=Name;$expand=DesktopGroup($select=Name)),User($select=FullName,Upn),Connections($select=LogOnStartDate,LogOnEndDate,BrokeringDuration,VMStartStartDate,VMStartEndDate,HdxStartDate,HdxEndDate,AuthenticationDuration,GpoStartDate,GpoEndDate,LogOnScriptsStartDate,LogOnScriptsEndDate,ProfileLoadStartDate,ProfileLoadEndDate,InteractiveStartDate,InteractiveEndDate,ClientName,ClientPlatform,Protocol,IsReconnect;$filter=IsReconnect eq false),&$select=StartDate,SessionKey,SessionType,LogonDuration&$orderby=LogOnDuration desc 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#Sessions",
    "value": [
        {
            "SessionKey":"f533b450-57eb-4ae1-89d6-393a02872e6c",
            "StartDate":"2024-11-26T15:06:55.157Z",
            "LogOnDuration":146957,
            "SessionType":0,
            "Machine":{
                "Name":"TEST\\LAB3-WPD216",
                "DesktopGroup":{
                    "Name":"LAB3-W10-P"
                }
            },
            "User":{
                "Upn":"user.name@citrix.com",
                "FullName":"User Name"
            },
            "Connections":[
                {
                    "ClientName":"CSGPROD152994",
                    "ClientPlatform":"Windows",
                    "IsReconnect":false,
                    "Protocol":"HDX",
                    "LogOnStartDate":"2024-11-28T07:34:58.353Z",
                    "LogOnEndDate":"2024-11-28T07:39:32.057Z",
                    "BrokeringDuration":24,
                    "VMStartStartDate":"2024-11-28T07:35:29.727Z",
                    "VMStartEndDate":"2024-11-28T07:36:56.51Z",
                    "HdxStartDate":"2024-11-28T07:37:15.893Z",
                    "HdxEndDate":"2024-11-28T07:37:17.6Z",
                    "AuthenticationDuration":1484,
                    "GpoStartDate":"2024-11-28T07:39:27.71Z",
                    "GpoEndDate":"2024-11-28T07:39:33.353Z",
                    "LogOnScriptsStartDate":null,
                    "LogOnScriptsEndDate":null,
                    "ProfileLoadStartDate":"2024-11-28T07:37:24.907Z",
                    "ProfileLoadEndDate":"2024-11-28T07:39:27.703Z",
                    "InteractiveStartDate":"2024-11-28T07:39:27.703Z",
                    "InteractiveEndDate":"2024-11-28T07:39:32.057Z"
                }
            ]
        }
    ]
}
<!--NeedCopy-->

Users with high ICARTT (low responsiveness)

As part of this example, we query for the SessionMetrics entity, which includes the ICARTT values. The linking to the Users entity is done through the Sessions entity.

Request

GET /monitorodata/SessionMetrics?$filter=CollectedDate ge 2025-05-01 and IcaRttMS gt 300&$select=IcaRttMS&$expand=Session($select=StartDate,SessionKey,SessionType;$expand=User($select=FullName,Upn),Machine($select=Name),CurrentConnection($select=ClientName,ClientPlatform,Protocol))&$orderby=IcaRttMS desc 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#Sessions",
    "value": [
        {
            "IcaRttMS":40203,
            "Session":{
                "SessionKey":"b28f7628-852a-4865-a1d2-2f7ab0a08310",
                "StartDate":"2024-11-21T16:18:20.123Z",
                "SessionType":0,
                "User":{
                    "Upn":"user.name@citrix.com",
                    "FullName":"User Name"
                },
                "Machine":{
                    "Name":"TEST\\LAB3-WPD216"
                },
                "CurrentConnection":{
                    "ClientName":"HTML-3420-2374",
                    "ClientPlatform":"HTML5",
                    "Protocol":"HDX"
                }
            }
        }
    ]
}
<!--NeedCopy-->
Resources
Citrix Monitor Service API OpenAPI Specification
Copy Download
User data request examples