Queries asynchronous tasks.

Usage notes

By default, this operation queries the tasks within the previous 24 hours. This operation allows you to query the tasks within a maximum of 7 days. You can specify the start time of the query by using Filter.

This topic provides an example on how to query the tasks within the previous 24 hours.

Limits

You can call this operation up to 20 times per second per account. This operation is globally limited to 100 times per second across all accounts. If the number of the calls per second exceeds a limit, throttling is triggered. As a result, your business may be affected. We recommend that you take note of the limits when you call this operation.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ListTasks

The operation that you want to perform. Set the value to ListTasks.

DirectoryId String Yes d-00fc2p61****

The ID of the directory.

AccessConfigurationId String No ac-00jhtfl8thteu6uj****

The ID of the access configuration. The ID can be used to filter asynchronous tasks.

TargetType String No RD-Account

The type of the task object. The type can be used to filter asynchronous tasks.

Set the value to RD-Account, which indicates an account in your resource directory.

Note You can use the type to filter asynchronous tasks only if you specify both TargetId and TargetType.
TargetId String No 114240524784****

The ID of the task object. The ID can be used to filter asynchronous tasks.

Note You can use the ID to filter asynchronous tasks only if you specify both TargetId and TargetType.
PrincipalType String No User

The type of the CloudSSO identity. The type can be used to filter asynchronous tasks. Valid values:

  • User
  • Group
Note You can use the type to filter asynchronous tasks only if you specify both PrincipalId and PrincipalType.
PrincipalId String No u-00q8wbq42wiltcrk****

The ID of the CloudSSO identity. The ID can be used to filter asynchronous tasks.

  • If you set PrincipalType to User, set PrincipalId to the ID of the CloudSSO user.
  • If you set PrincipalType to Group, set PrincipalId to the ID of the CloudSSO group.
Note You can use the ID to filter asynchronous tasks only if you specify both PrincipalId and PrincipalType.
TaskType String No CreateAccessAssignment

The type of the task. The type can be used to filter asynchronous tasks. Valid values:

  • ProvisionAccessConfiguration: An access configuration is provisioned.
  • DeprovisionAccessConfiguration: An access configuration is de-provisioned.
  • CreateAccessAssignment: Access permissions on an account in your resource directory are assigned.
  • DeleteAccessAssignment: Access permissions on an account in your resource directory are removed.
Status String No Success

The ID of the task. The ID can be used to filter asynchronous tasks. Valid values:

  • InProgress: The task is running.
  • Success: The task is successful.
  • Failed: The task failed.
NextToken String No K1c3o9K7pFxoTtxH1Nm7MMLb7zrDGvftYBQBPDVv7AD3a8yhRb3Mk8L9ivmN6bFSjfkZNTAg3h4****

The token to return for the next page. If this is your first time to call this operation, you do not need to specify NextToken.

When you call this operation for the first time, if the total number of entries to return exceeds the value of MaxResults, the entries are truncated. Only the entries that match the value of MaxResults are returned, and the excess entries are not returned. In this case, the value of the response parameter IsTruncated is true, and NextToken is returned. In the next call, you can use the value of NextToken and maintain the settings of the other request parameters to query the excess entries. You can repeat the call until the value of IsTruncated becomes false. This way, all entries are returned.

MaxResults Integer No 10

The number of entries to return on each page.

Valid values: 1 to 20.

Default value: 10.

Filter String No StartTime ge 2021-03-15T01:12:23Z

The filter condition.

Specify the value in the <Attribute> <Operator> <Value> format. The value is not case sensitive. You can set Attribute only to StartTime and Operator only to ge. You must set Value in the YYYY-MM-DDTHH:mm:SSZ format and enter a value that is no more than 7 days from the current time. The value ge indicates Greater Than or Equals.

For example, if you set Filter to StartTime ge 2021-03-15T01:12:23Z, the operation queries the tasks from 2021-03-15T01:12:23 GMT.

Note If you do not specify this parameter, the operation queries the tasks within the previous 24 hours by default.

For more information about common request parameters, see Common parameters.

Response parameters

Parameter Type Example Description
Tasks Array of Task

The tasks.

Status String Success

The status of the task. Valid values:

  • InProgress: The task is running.
  • Success: The task is successful.
  • Failed: The task failed.
TaskId String t-sh5k4gesm6twlrqb****

The ID of the task.

EndTime String 2021-11-09T05:50:50Z

The time when the task ended.

PrincipalId String u-00q8wbq42wiltcrk****

The ID of the CloudSSO identity.

TargetPath String rd-3G****/r-Wm****/114240524784****

The path ID of the task object in your resource directory.

StartTime String 2021-11-09T05:50:50Z

The time when the task started.

PrincipalName String Alice

The name of the CloudSSO identity.

TargetName String dev-test

The name of the task object.

TargetId String 114240524784****

The ID of the task object.

AccessConfigurationName String ECS-Admin

The name of the access configuration.

TargetPathName String rd-3G****/root/dev-test

The path name of the task object in your resource directory.

TaskType String CreateAccessAssignment

The type of the task. Valid values:

  • ProvisionAccessConfiguration: An access configuration is provisioned.
  • DeprovisionAccessConfiguration: An access configuration is de-provisioned.
  • CreateAccessAssignment: Access permissions on an account in your resource directory are assigned.
  • DeleteAccessAssignment: Access permissions on an account in your resource directory are removed.
FailureReason String No Permission.

The cause of the task failure.

Note This parameter is returned only when the value of Status is Failed.
TargetType String RD-Account

The type of the task object.

The value is fixed as RD-Account, which indicates an account in your resource directory.

AccessConfigurationId String ac-00jhtfl8thteu6uj****

The ID of the access configuration.

PrincipalType String User

The type of the CloudSSO identity. Valid values:

  • User
  • Group
NextToken String K1c3o9K7pFxoTtxH1Nm7MMLb7zrDGvftYBQBPDVv7AD3a8yhRb3Mk8L9ivmN6bFSjfkZNTAg3h4****

The token that is returned for the next page.

Note This parameter is returned only when the value of IsTruncated is true.
RequestId String C0DA2DFC-EB18-59EF-BD82-C30862EBA3A3

The ID of the request.

MaxResults Integer 10

The number of entries returned per page.

TotalCounts Integer 1

The total number of entries returned.

IsTruncated Boolean false

Indicates whether the queried entries are truncated. Valid values:

  • true: The queried entries are truncated.
  • false: The queried entries are not truncated.

Examples

Sample requests

https://[Endpoint]/?Action=ListTasks
&DirectoryId=d-00fc2p61****
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<ListTasksResponse>
	<Tasks>
		<Task>
			<Status>Success</Status>
			<TaskId>t-sh5k4gesm6twlrqb****</TaskId>
			<EndTime>2021-11-09T05:50:50Z</EndTime>
			<PrincipalId>u-00q8wbq42wiltcrk****</PrincipalId>
			<TargetPath>rd-3G****/r-Wm****/114240524784****</TargetPath>
			<StartTime>2021-11-09T05:50:50Z</StartTime>
			<PrincipalName>Alice</PrincipalName>
			<TargetName>dev-test</TargetName>
			<TargetId>114240524784****</TargetId>
			<AccessConfigurationName>ECS-Admin</AccessConfigurationName>
			<TargetPathName>rd-3G****/root/dev-test</TargetPathName>
			<TaskType>CreateAccessAssignment</TaskType>
			<TargetType>RD-Account</TargetType>
			<AccessConfigurationId>ac-00jhtfl8thteu6uj****</AccessConfigurationId>
			<PrincipalType>User</PrincipalType>
		</Task>
	</Tasks>
	<RequestId>C0DA2DFC-EB18-59EF-BD82-C30862EBA3A3</RequestId>
	<MaxResults>10</MaxResults>
	<TotalCounts>1</TotalCounts>
	<IsTruncated>false</IsTruncated>
</ListTasksResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "Tasks" : [ {
    "Status" : "Success",
    "TaskId" : "t-sh5k4gesm6twlrqb****",
    "EndTime" : "2021-11-09T05:50:50Z",
    "PrincipalId" : "u-00q8wbq42wiltcrk****",
    "TargetPath" : "rd-3G****/r-Wm****/114240524784****",
    "StartTime" : "2021-11-09T05:50:50Z",
    "PrincipalName" : "Alice",
    "TargetName" : "dev-test",
    "TargetId" : "114240524784****",
    "AccessConfigurationName" : "ECS-Admin",
    "TargetPathName" : "rd-3G****/root/dev-test",
    "TaskType" : "CreateAccessAssignment",
    "TargetType" : "RD-Account",
    "AccessConfigurationId" : "ac-00jhtfl8thteu6uj****",
    "PrincipalType" : "User"
  } ],
  "RequestId" : "C0DA2DFC-EB18-59EF-BD82-C30862EBA3A3",
  "MaxResults" : 10,
  "TotalCounts" : 1,
  "IsTruncated" : false
}

Error codes

For a list of error codes, visit the API Error Center.