Updated on 2025-10-24 GMT+08:00

Modifiying Scripts

Function

This APl is used to modify scripts.

Constraints

Constraints:

  • Script name: The script name must be unique under the same tenant. The value can contain a maximum of 64 characters, including letters, digits, and underscores (_).

  • The script content can contain a maximum of 4096 characters.

  • A maximum of 20 script parameters are supported.

  • Script Description: Enter a maximum of 256 characters.

  • The name of a single parameter contains 64 characters, including only letters, digits, and underscores (_).

  • The value of a parameter can contain a maximum of 1024 characters. The regular expression is ^((?!.{2,})[a-zA-Z0-9_-/.\x20?:",=+@[{]}])$.

  • If the modified script has a reviewer, you need to select reviewers again after the modification.

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

    coc:document:update

    Write

    document *

    -

    -

    -

URI

PUT /v1/job/scripts/{script_uuid}

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

script_uuid

Yes

String

Definition:

Script UUID.

Constraints:

N/A.

Value range:

N/A.

Default value:

N/A.

Request Parameters

Table 2 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition:

Tenant token.

Constraints:

Tenant token obtained from IAM.

Value range:

N/A.

Default value:

N/A.

X-Language

No

String

Definition:

Internationalization tag. zh-cn indicates Chinese, and en-us or no value indicates English.

Constraints:

zh-cn indicates Chinese, and en-us or no value indicates English.

Value range:

zh-cn and en-us

Default value:

N/A.

x-project-id

No

String

Definition:

The project ID.

Constraints:

Project ID corresponding to the region.

Value range:

N/A.

Default value:

N/A.

x-user-profile

No

String

Definition:

IAM 5.0 user information.

Constraints:

N/A.

Value range:

N/A.

Default value:

N/A.

Table 3 Request body parameters

Parameter

Mandatory

Type

Description

description

Yes

String

Definition:

Script description.

Constraints:

N/A.

Value range:

N/A.

Default value:

N/A.

content

Yes

String

Definition:

Script content.

Constraints:

N/A.

Value range:

N/A.

Default value:

N/A.

properties

No

ScriptPropertiesModel object

Definition:

Script attribute.

Constraints:

N/A.

Value range:

N/A.

Default value:

N/A.

script_params

No

Array of ScriptParamDefine objects

Definition:

Input parameters of the script.

Constraints:

N/A.

Value range:

N/A.

Default value:

N/A.

Table 4 ScriptPropertiesModel

Parameter

Mandatory

Type

Description

risk_level

Yes

String

Definition:

Risk level.

Constraints:

  • LOW

  • MEDIUM

  • HIGH

Value range:

LOW, MEDIUM, or HIGH.

Default value:

N/A.

version

Yes

String

Definition:

Script version.

Constraints:

Format: 1.0.0

Value range:

N/A.

Default value:

N/A.

reviewers

No

Array of ReviewerInfo objects

Definition:

Reviewer. If this parameter is not specified, review is not required.

Constraints:

N/A.

Value range:

N/A.

Default value:

N/A.

protocol

No

String

Definition:

Review message notification protocol, which is used to notify the reviewer.

Constraints:

  • DEFAULT

  • SMS

EMAIL,

DING_TALK,

WE_LINK,

WECHAT,

CALLNOTIFY,

and NOT_TO_NOTIFY.

Value range:

DEFAULT, SMS, EMAIL, DING_TALK, WE_LINK, WECHAT, CALLNOTIFY, or NOT_TO_NOTIFY.

Default value:

N/A.

Table 5 ReviewerInfo

Parameter

Mandatory

Type

Description

reviewer_name

Yes

String

Definition:

Reviewer name (IAM username).

Constraints:

IAM username.

Value range:

N/A.

Default value:

N/A.

reviewer_id

Yes

String

Definition:

Reviewer ID (IAM user ID).

Constraints:

IAM user ID.

Value range:

N/A.

Default value:

N/A.

Table 6 ScriptParamDefine

Parameter

Mandatory

Type

Description

param_name

Yes

String

Definition:

Parameter name.

Constraints:

The parameter name can contain only letters, digits, and underscores (_).

Value range:

N/A.

Default value:

N/A.

param_value

Yes

String

Definition:

Parameter value.

Constraints:

The parameter value contains 1 to 4096 characters.

The value can contain uppercase letters, lowercase letters, digits, and special characters (_-/.*?:",=+@#[{]}).

Consecutive periods (.) are not allowed.

Value range:

N/A.

Default value:

N/A.

param_description

Yes

String

Definition:

Parameter description.

Constraints:

N/A.

Value range:

N/A.

Default value:

N/A.

param_order

Yes

Integer

Definition:

Parameter sequence. This parameter has been discarded and does not take effect when it is configured.

Constraints:

N/A.

Value range:

N/A.

Default value:

N/A.

sensitive

Yes

Boolean

Definition:

Whether a parameter is sensitive.

Constraints:

The value can be true or false.

Value range:

The value can be true or false.

Default value:

N/A.

Response Parameters

Status code: 200

Table 7 Response body parameters

Parameter

Type

Description

data

String

Definition:

UUID of the script to be modified.

Value range:

N/A.

Status code: 400

Table 8 Response body parameters

Parameter

Type

Description

error_code

String

Definition:

Error code.

Value range:

See the error code section.

error_msg

String

Definition:

Error description.

Value range:

See the error code section.

Example Requests

Modify the example of the request body of the SHELL script.

PUT https://{Endpoint}/v1/job/scripts/SC2023110211155901a700000

{
  "type" : "SHELL",
  "content" : "echo ${a}",
  "name" : "019101112",
  "description" : "Modifying",
  "properties" : {
    "risk_level" : "HIGH",
    "version" : "1.1.1",
    "reviewers" : [ ]
  },
  "script_params" : [ {
    "param_name" : "a",
    "param_value" : "string",
    "param_description" : "string",
    "param_order" : 1,
    "sensitive" : true
  } ]
}

Example Responses

Status code: 200

The script UUID is returned.

For more status codes, see Status Codes.

{
  "data" : "SC2023110211155901axxxxxx"
}

Status code: 400

The server failed to process the request.

For more status codes, see Status Codes.

{
  "error_code" : "COC.00040701",
  "error_msg" : "error_msg"
}

Status Codes

Status Code

Description

200

The script UUID is returned.

For more status codes, see Status Codes.

400

The server failed to process the request.

For more status codes, see Status Codes.

Error Codes

See Error Codes.