Help Center/ Workspace/ API Reference/ Workspace APIs/ Report Statistics/ Querying the Desktop Usage Duration
Updated on 2026-02-10 GMT+08:00

Querying the Desktop Usage Duration

Function

Queries desktop usage duration. This API has been discarded and is not recommended. You are advised to use the APIs for querying desktop usage statistics and querying user usage statistics.

Debugging

You can debug this API through automatic authentication in API Explorer or use the SDK sample code generated by API Explorer.

Authorization Information

Each account has all the permissions required to call all APIs, but IAM users must be assigned the required permissions.

  • If you are using role/policy-based authorization, see Permissions Policies and Supported Actions for details on the required permissions.
  • If you are using identity policy-based authorization, the following identity policy-based permissions are required.

    Action

    Access Level

    Resource Type (*: required)

    Condition Key

    Alias

    Dependencies

    workspace:statistics:getUsed

    Read

    -

    -

    -

    -

URI

POST /v2/{project_id}/desktops/statistics/used

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID.

Request Parameters

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

desktop_ids

No

Array of strings

Desktop ID set.

start_time

No

String

Start time. The format is yyyy-MM-dd (UTC time). If this parameter is not specified, data of the latest 15 days is queried by default. Data of a maximum of 31 days can be queried.

end_time

No

String

End time. The format is yyyy-MM-dd (UTC time). If this parameter is not specified, data of the latest 15 days is queried by default. Data of a maximum of 31 days can be queried.

group_by_type

No

String

Statistics collection mode. If this parameter is not transferred, the default value is day. Options:

  • DAY: by day.

  • HOUR: by hour.

desktop_username

No

String

If the username of the desktop is specified, only the usage time of the user is queried.

desktop_user_domain

No

String

Domain to which the desktop user belongs. The default domain is the primary domain.

offset

No

Integer

Sequence number of the first data record to be returned. This parameter is used for pagination query. The value ranges from 0 (default) to 2147483647.

limit

No

Integer

Number of information items to be returned in the query result. This parameter is used for pagination query. The value ranges from 0 to 100. The default value is 100.

Response Parameters

Status code: 200

Table 3 Response body parameters

Parameter

Type

Description

desktop_used_info_list

Array of DesktopUsedHoursInfo objects

Desktop usage information (divided by desktop ID).

total_count

Integer

Total number.

Table 4 DesktopUsedHoursInfo

Parameter

Type

Description

desktop_id

String

Desktop ID.

desktop_username

String

User.

used_info_list

Array of DesktopUsedInfo objects

List of desktop usage time.

Table 5 DesktopUsedInfo

Parameter

Type

Description

date

String

Date. The format is yyyy-MM-dd (UTC time).

use_time

String

Total online duration, in hours. The value is accurate to two decimal places, for example, 1.32.

Status code: default

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code, which is returned upon failure.

error_msg

String

Error message.

error_detail

String

Error details.

encoded_authorization_message

String

Encrypted detailed reason for rejection. You can call the API decode-authorization-message of STS to decrypt the reason.

Example Requests

GET /v2/9565be6e740941c493b38a1f46ecae6f/desktops/statistics/used

{
  "desktop_ids" : [ "c6e6dbd7-c950-471d-a6a7-01d0fb62f450", "d5367f84-1d64-498e-9b92-093002ac6ce9" ],
  "start_time" : "2022-12-09",
  "end_time" : "2022-12-15"
}

Example Responses

Status code: 200

Response to the request for querying the desktop usage duration.

{
  "desktop_used_info_list" : [ {
    "desktop_id" : "c6e6dbd7-c950-471d-a6a7-01d0fb62f450",
    "used_info_list" : [ {
      "date" : "2022-12-09",
      "use_time" : 12.62
    }, {
      "date" : "2022-12-10",
      "use_time" : 2.62
    }, {
      "date" : "2022-12-11",
      "use_time" : 1.02
    }, {
      "date" : "2022-12-12",
      "use_time" : 0
    }, {
      "date" : "2022-12-13",
      "use_time" : 0
    }, {
      "date" : "2022-12-14",
      "use_time" : 3.87
    }, {
      "date" : "2022-12-15",
      "use_time" : 3.56
    } ]
  }, {
    "desktop_id" : "d5367f84-1d64-498e-9b92-093002ac6ce9",
    "used_info_list" : [ {
      "date" : "2022-12-09",
      "use_time" : 10.56
    }, {
      "date" : "2022-12-10",
      "use_time" : 1.38
    }, {
      "date" : "2022-12-11",
      "use_time" : 0
    }, {
      "date" : "2022-12-12",
      "use_time" : 0
    }, {
      "date" : "2022-12-13",
      "use_time" : 0
    }, {
      "date" : "2022-12-14",
      "use_time" : 3.87
    }, {
      "date" : "2022-12-15",
      "use_time" : 3.56
    } ]
  } ],
  "total_count" : 2
}

Status Codes

Status Code

Description

200

Response to the request for querying the desktop usage duration.

default

Error response.

Error Codes

See Error Codes.