StopAppResources
Stops application resources.
Operation description
Before you begin
Before you call this operation, you must complete user logon authentication to obtain the LoginToken and SessionId. This StopAppResources operation uses the 2021-09-03 version of appstream-center. The prerequisite logon operation uses the 2021-02-20 version of GetLoginToken. Use the respective API versions for each operation.
1. Prepare the enterprise identifier and account information
The following procedure applies to password-based authentication for convenience users or Active Directory (AD) domain users who log on by using an enterprise identifier.
| Parameter | Description |
ClientId | The unique ID generated by the client. This parameter is required when you call GetLoginToken. The same client ID is reused in the subsequent call sequence. |
LoginIdentifier | The enterprise identifier for logon, which is the TenantAlias. The parameter name in the logon request is LoginIdentifier, not TenantAlias. To query the logon configuration of this identifier, you can call FindIdpListByLoginIdentifier (2021-02-20). The TenantAliasInfo.TenantAlias field in the response indicates the enterprise identifier. |
CurrentStage | Set this parameter to ADPassword for password-based authentication. This value applies to both convenience users and AD domain users, not only AD domain users. |
EndUserId | The username of the convenience user or AD domain user. This parameter is required when CurrentStage is set to ADPassword. |
Password | The password of the corresponding account. This parameter is required when CurrentStage is set to ADPassword. |
2. Continue logon based on the returned authentication stage
After you invoke GetLoginToken for the first time, save the returned SessionId. This value is returned only during the first invocation in the same logon session. If you need to continue to authenticate, include the saved SessionId in subsequent requests. Do not clear this value even if it is not returned in subsequent responses.
Determine whether you still need to authenticate based on the NextStage field in the response, and set the required next authentication stage as the CurrentStage for subsequent requests. Examples:
| Next authentication stage | What to do next |
MFAVerify | Include the SessionId and the AuthenticationCode generated by the virtual MFA device to continue to invoke GetLoginToken. |
TokenVerify | Include the SessionId and the client secondary authentication authenticate code TokenCode to continue to authenticate. |
ChangePassword | Specify OldPassword and NewPassword as required to complete the password change stage. |
MFABind or other authentication stages | Complete the corresponding operations based on the actual returned stage and the GetLoginToken documentation. Do not directly apply the request parameters of MFAVerify. |
The authentication stages are determined by the account configuration and the result of the current logon. Not every logon must go through all the preceding stages in sequence. Invoke StopAppResources only after logon authentication is complete and the LoginToken is obtained. Do not proceed to shutdown resources if authentication failed or if there are pending authentication stages.
3. Call sequence example
The following is pseudocode for parameter passing and is not an executable SDK example. clientId, tenantAlias, endUserId, password, and authenticationCode are runtime variables of the caller. resourceIds, productType, and appInstanceGroupId are business parameters for this operation. Do not write real passwords, verification codes, or logon credentials in examples or logs.
login1 = GetLoginToken(version="2021-02-20",
ClientId=clientId, LoginIdentifier=tenantAlias,
CurrentStage="ADPassword", EndUserId=endUserId, Password=password)
sessionId = login1.SessionId
loginResult = login1
if loginResult.NextStage == "MFAVerify":
loginResult = GetLoginToken(version="2021-02-20",
ClientId=clientId, LoginIdentifier=tenantAlias,
SessionId=sessionId, CurrentStage="MFAVerify",
AuthenticationCode=authenticationCode)
If other authentication stages are still required, continue processing based on NextStage. Do not treat the preceding single MFA call as the fixed endpoint. After logon is complete, use the LoginToken obtained from this logon and the saved SessionId to call this operation:
StopAppResources(version="2021-09-03",
ClientId=clientId, LoginToken=loginResult.LoginToken, SessionId=sessionId,
ProductType=productType, AppInstanceGroupId=appInstanceGroupId,
ResourceIds=resourceIds)
Password, LoginIdentifier, and CurrentStage belong to the prerequisite logon request and are not request parameters of StopAppResources. For the rules on how to specify other parameters and resource IDs for this operation, see the request parameter table below.
Try it now
Test
RAM authorization
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| BizRegionId |
string |
No |
The business region ID. |
cn-hangzhou |
| LoginToken |
string |
Yes |
The logon token. |
v12369636c721ba6b3ddb1683341016775c3f63e4d0e78f120f9a0544ed826b7af7daf747c402f0d0730b52f451b70**** |
| EndUserId |
string |
No |
The username. |
testUser |
| SessionId |
string |
Yes |
The session ID. |
597e869d-ea14-4b83-9490-714f68bfe935 |
| LoginRegionId |
string |
No |
The region ID used when logging on to the office network. |
cn-hangzhou |
| Uuid |
string |
No |
The client UUID. |
C50973691A6D2BE23F2CDD73B85B**** |
| ClientId |
string |
Yes |
The client ID. |
eac19bef-1e45-4190-a03a-4ea74b699ca7 |
| ClientOS |
string |
No |
The operating system of the client. |
windows_"Windows 10 Enterprise" 10.0 (Build 19042) |
| ClientVersion |
string |
No |
The client version. |
7.2.0-R-20241008.110000 |
| ClientIp |
string |
No |
The IP address of the client. |
1.2.3.4 |
| ProductType |
string |
Yes |
The product type. Valid values:
|
AndroidCloud |
| AppInstanceGroupId |
string |
Yes |
The resource group ID. |
aig-9ciijz60n4xsv**** |
| ResourceIds |
array |
Yes |
The list of resource IDs. |
|
|
string |
Yes |
The resource ID. For cloud phones, pass in the persistent session ID. |
p-00001 |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response. |
||
| RequestId |
string |
The request ID. |
829444D6-9FD3-5C65-A570-065975537647 |
| Code |
string |
The error code. |
InvalidAppInstanceGroup.NotFound |
| Message |
string |
The error message. |
The app instance group is not found. |
| Success |
string |
Indicates whether the request is successful. A value of true indicates success, and a value of false indicates failure. |
true |
Examples
Success response
JSON format
{
"RequestId": "829444D6-9FD3-5C65-A570-065975537647",
"Code": "InvalidAppInstanceGroup.NotFound",
"Message": "The app instance group is not found.",
"Success": "true"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | NOT_LOGIN | You are not logged in or your login token has expired. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.