Restart Instances

Last updated: 2018-09-10 21:32:11

1. API Description

This API (RestartInstances) is used to restart instances.

Domain name for API request: cvm.api.qcloud.com

  • You can simply pass instanceId; this API supports passing IDs in batch.
  • Some applications running in an instance can cause a failure of normal shutdown. In this case, you can add forceStop parameter to allow the API to use a forced shutdown policy after a shutdown failure. Forced shutdown will not be performed by default.

2. Input Parameters

The following list only provides API request parameters. For additional parameters, refer to Public Request Parameters page.

Parameter Name Required Type Description
instanceIds.n Yes String ID of the instance to be operated. It can be obtained from unInstanceId in the returned value of DescribeInstances API. This API allows passing multiple IDs at a time. For the format of this parameter, refer to id.n section of API Introduction.
forceStop No Int Indicate whether a forced shutdown is performed. A value of 0 indicates a normal shutdown, and a value of 1 indicates a forced shutdown. The default is 0.

3. Output Parameters

Parameter Name Type Description
code Int Common error code. A value of 0 indicates success, and other values indicate failure. For more information, refer to Common Error Codes on Error Code page.
message String Module error message description depending on API. For more information, refer to Module Error Codes on Error Code page.
detail Array Refer to Format of Returned Results of Batch Asynchronous Task API.

4. Error Codes

The following list only provides the business logic error codes for this API. For additional common error codes, refer to CVM Error Codes page.

Error Code Description
OperationConstraints.InvaildInstanceStatus Instance status is incorrect or the attempt to obtain the instance status failed (EC_CVM_STATUS_ERROR)

5. Example

Input

  https://cvm.api.qcloud.com/v2/index.php?Action=RestartInstances
  &instanceIds.0=ins-r8hr2upy
  &<Public request parameters>

Output

Refer to Format of Returned Results of Batch Asynchronous Task API