tencent cloud

ModifyCommand
Last updated:2026-03-05 16:27:12
ModifyCommand
Last updated: 2026-03-05 16:27:12

1. API Description

Domain name for API request: tat.intl.tencentcloudapi.com.

This API is used to modify a command.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: ModifyCommand.
Version Yes String Common Params. The value used for this API: 2020-10-28.
Region Yes String Common Params. For more information, please see the list of regions supported by the product.
CommandId Yes String

Command ID. call the DescribeCommands api to query command details.

.
CommandName No String

Command name. name only supports chinese, english, digits, underscore, separator "-", and decimal point. the maximum length cannot exceed 60 bytes.

.
Description No String

Command description. no more than 120 characters.

.
Content No String

The Base64-encoded command content, length cannot exceed 64KB.

.
CommandType No String

Command type. currently supports SHELL, POWERSHELL, BAT.

.
WorkingDirectory No String

Command execution path.

.
Timeout No Integer

Command timeout time.

value range: [1, 86400].

unit: seconds.

default value: 60.

when specifying the OutputCOSBucketUrl parameter, the timeout period includes the time taken to upload command output to COS.

.
DefaultParameters No String

The default value of custom parameters when the custom parameter feature is enabled. the field type is a json-encoded string, for example: {"varA": "222"}.
parameters must not be specified simultaneously for DefaultParameters and DefaultParameterConfs.
a comprehensive modification is applied, meaning all new default values must be provided when modifying.
this parameter can be modified only when EnableParameter of the command is true. obtain the EnableParameter settings of the command through the DescribeCommands (query command details) api.
the key is the custom parameter name, and the value is the default value of this parameter. both key and value are string-type.
there is an upper limit of 20 custom parameters.
custom parameter names must meet the following requirements: the upper limit of character quantity is 64, and the optional range is [a-zA-Z0-9-_].

.
DefaultParameterConfs.N No Array of DefaultParameterConf

Custom parameter array. if no parameter value is provided when invoking the command, the default value here will be used to replace it.
parameters do not support specifying both DefaultParameters and DefaultParameterConfs.
this parameter can be modified only when EnableParameter of the command is true. obtain the EnableParameter settings through the DescribeCommands (query command details) api.
up to 20 custom parameters are allowed.

.
Username No String

The username to run commands in a CVM or Lighthouse instance.
using minimum permission to execute commands is the best practice for permission management. we recommend running cloud assistant commands as a regular user identity.

.
OutputCOSBucketUrl No String

Specifies the cos bucket address for the uploaded log, which must start with https, such as https://BucketName-123454321.cos.ap-beijing.myqcloud.com.

.
OutputCOSKeyPrefix No String

Specify the directory for logs in the cos bucket. the directory naming has the following rules:

  1. use a combination of numbers, chinese and english, and visible characters, with a maximum length of 60.
  2. use / to split the path and quickly create subdirectories.
  3. consecutive / are not allowed; cannot start with /; cannot use .. as the folder name.
.

3. Output Parameters

Parameter Name Type Description
RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem.

4. Example

Example1 Modify Command

Input Example

POST / HTTP/1.1
Host: tat.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: ModifyCommand
<Common request parameters>

{
    "CommandName": "second-command",
    "Description": "hello world!",
    "Content": "cHM=",
    "CommandType": "SHELL",
    "WorkingDirectory": "/root",
    "Timeout": 600,
    "CommandId": "cmd-63usjhmq"
}

Output Example

{
    "Response": {
        "RequestId": "9bea970a-0bab-495f-b0dd-de5eedfdf611"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
InternalError Internal error.
InvalidParameter Invalid parameter.
InvalidParameterValue Invalid parameter value.
InvalidParameterValue.CommandContentInvalid Invalid command content.
InvalidParameterValue.CommandNameDuplicated Duplicate command name.
InvalidParameterValue.InvalidCommandId Invalid CommandId.
InvalidParameterValue.InvalidCommandName Invalid command name.
InvalidParameterValue.InvalidOutputCOSBucketUrl Invalid OutputCOSBucketUrl.
InvalidParameterValue.InvalidOutputCOSKeyPrefix Invalid OutputCOSKeyPrefix.
InvalidParameterValue.InvalidWorkingDirectory Invalid command execution path.
InvalidParameterValue.ParameterInvalidJsonFormat The parameter is not a valid JSON string.
InvalidParameterValue.ParameterKeyContainsInvalidChar The parameter key contains invalid characters.
InvalidParameterValue.ParameterKeyDuplicated Duplicate parameter keys.
InvalidParameterValue.ParameterKeyLenExceeded The parameter key is too long.
InvalidParameterValue.ParameterNumberExceeded Too many parameters.
InvalidParameterValue.ParameterValueNotString The parameter value is not a string.
InvalidParameterValue.Range The parameter value is not in the valid range.
InvalidParameterValue.SupportParametersOnlyIfEnableParameter The custom parameter feature is not enabled.
InvalidParameterValue.TooLong Length limit exceeded.
ResourceNotFound.CommandNotFound The command does not exist.
ResourceNotFound.CosBucketNotFoundCode CosBucket does not exist.
UnauthorizedOperation.CamAuthFailed CAM authentication failed.
UnauthorizedOperation.InvalidToken Invalid token.
UnauthorizedOperation.MFAExpired The Multi-factor authentication (MFA) code expired.
UnauthorizedOperation.MFANotFound Multi-factor authentication (MFA) does not exist.
Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback