How to retrieve data related to application instance

Application instance is the record of an instance of a running application. Use Citrix Monitor Service API to get the details of application instance.

Prerequisites

ApplicationInstances for non-terminated sessions

  • EndDate is null and ConnectionState!=3 represents not terminated sessions.

Request

GET /monitorodata/ApplicationInstances?$filter=EndDate eq null and Session/ConnectionState ne 3 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#ApplicationInstances",
    "value": [
        {
            "Id": 13360858,
            "ApplicationId": "6b07220e-b7d2-4f8d-9e43-49bd85222553",
            "SessionKey": "8276e98f-0b20-4789-8a2f-27d526fabd53",
            "StartDate": "2024-07-28T09:55:53.11Z",
            "EndDate": null,
            "CreatedDate": "2024-07-28T09:55:53.11Z",
            "ModifiedDate": "2024-07-28T09:55:53.11Z"
        }
    ]
}
<!--NeedCopy-->

ApplicationInstances for target application with Machine and User information

  • Use filter operation to get the details for target application.
  • Use expand operation to get the related Machine and User Information.

Request

GET /monitorodata/ApplicationInstances?$apply=filter(ApplicationId eq 6b07220e-b7d2-4f8d-9e43-49bd85222553 and EndDate eq null)&$expand=Session($expand=Machine,User) 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#ApplicationInstances(Session(Machine(),User()))",
    "value": [
        {
            "Id": 13361311,
            "ApplicationId": "6b07220e-b7d2-4f8d-9e43-49bd85222553",
            "SessionKey": "762e418d-270f-4db1-bc7a-2eb3747825fb",
            "StartDate": "2024-07-28T10:06:19.363Z",
            "EndDate": null,
            "CreatedDate": "2024-07-28T10:06:19.363Z",
            "ModifiedDate": "2024-07-28T10:06:19.363Z",
            "Session": {
                "SessionKey": "762e418d-270f-4db1-bc7a-2eb3747825fb",
                "StartDate": "2024-07-28T10:06:05.397Z",
                "LogOnDuration": 15408,
                "EndDate": null,
                "ExitCode": 1,
                "FailureId": null,
                "FailureDate": null,
                "ConnectionState": 5,
                "SessionIdleTime": null,
                "ConnectionStateChangeDate": "2024-07-28T10:06:17.55Z",
                "LifecycleState": 0,
                "CurrentConnectionId": 33952565,
                "UserId": 103038,
                "MachineId": "b5630f84-9234-485c-bb3b-68217feb451b",
                "SessionType": 1,
                "IsAnonymous": false,
                "PublishedDesktopId": null,
                "CreatedDate": "2024-07-28T10:06:17.55Z",
                "ModifiedDate": "2024-08-02T08:08:38Z",
                "Machine": {
                    "Id": "b5630f84-9234-485c-bb3b-68217feb451b",
                    "Sid": "S-1-5-21-420551719-245851362-9522986-884824",
                    "Name": "XXXX\\ADEAPPRB2D048",
                    "DnsName": "test.wa.test.org",
                    "LifecycleState": 0,
                    "IPAddress": "10.10.201.250",
                    "HostedMachineId": "423fd007-86ff-7729-96bf-f4cd05646e0a",
                    "HostingServerName": "test.test.org",
                    "HostedMachineName": "test",
                    "IsAssigned": false,
                    "IsInMaintenanceMode": true,
                    "IsPendingUpdate": false,
                    "AgentVersion": "1912.0.7000.7052",
                    "AssociatedUserFullNames": "auto1005255",
                    "AssociatedUserNames": "test\\auto1005255",
                    "AssociatedUserUPNs": "auto1005255@test.org",
                    "CurrentRegistrationState": 1,
                    "RegistrationStateChangeDate": "2024-07-26T05:00:32.447Z",
                    "LastDeregisteredCode": 300,
                    "LastDeregisteredDate": "2024-07-19T07:38:43.81Z",
                    "CurrentPowerState": 3,
                    "CurrentSessionCount": 1,
                    "ControllerDnsName": "test.local",
                    "PoweredOnDate": null,
                    "PowerStateChangeDate": "2024-07-24T10:09:09.293Z",
                    "FunctionalLevel": 7,
                    "FailureDate": null,
                    "WindowsConnectionSetting": 0,
                    "IsPreparing": false,
                    "FaultState": 1,
                    "OSType": "Windows 2019",
                    "CurrentLoadIndexId": 258229225,
                    "CatalogId": "693997ce-3024-4116-9b25-964a0b2f5f66",
                    "DesktopGroupId": "1377ad1d-b245-4782-b7b4-45b093ae1fe5",
                    "HypervisorId": "5ac693e1-2fb4-4293-97f2-3c4338e0aff0",
                    "LastPowerActionType": 4,
                    "LastPowerActionReason": 5,
                    "LastPowerActionFailureReason": 400,
                    "LastPowerActionCompletedDate": "2024-07-26T04:59:41.257Z",
                    "Tags": [],
                    "Hash": "B136809A5709E6F020D3C5095A4FAC5C1F31AA4B5C78064C3F7102E56C4BF0D3",
                    "MachineRole": 0,
                    "CreatedDate": "2024-01-26T23:25:41.88Z",
                    "ModifiedDate": "2024-07-31T00:08:38.86Z"
                },
                "User": {
                    "Id": 103038,
                    "Sid": "S-1-5-21-1518083187-624064714-1050887974-125084",
                    "Upn": "auto1005255@ak.test.org",
                    "UserName": "auto1005255",
                    "FullName": "auto1005255",
                    "Domain": "test",
                    "CreatedDate": "2023-07-12T04:43:39.47Z",
                    "ModifiedDate": "2023-07-12T04:43:39.47Z"
                }
            }
        }
    ]
}
<!--NeedCopy-->
Resources
Citrix Monitor Service API OpenAPI Specification
Copy Download
How to retrieve data related to application instance