Help Center/ CodeArts Check/ API Reference/ APIs/ Rule Management/ Modifying Enabled Rules in a Rule Set
Updated on 2026-02-03 GMT+08:00

Modifying Enabled Rules in a Rule Set

Function

This API is used to add rules to or delete rules from a rule set, modify the configuration parameters of enabled rules, modify the rule alarm delay, alarm severity, and rule application scope.

Calling Method

For details, see Calling APIs.

Authorization Information

Each account root user has all the permissions required to call all APIs, but IAM users must be assigned the following required identity policy-based permissions. For details about the required permissions, see Permissions Policies and Supported Actions.

Action

Access Level

Resource Type (*: required)

Condition Key

Alias

Dependencies

codeartscheck::updateRuleSet

Write

-

-

-

-

URI

POST /v1/relations

Request Parameters

Table 1 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition :

User token. Obtain one by calling the IAM API Obtaining a User Token. The value of X-Subject-Token in the response header is a token.

Constraints:

N/A

Value range:

1–100,000 characters.

Default value:

N/A

operator

No

String

Definition:

Operator username.

Constraints:

N/A

Value range:

1 to 128 characters.

Default value:

N/A

Table 2 Request body parameters

Parameter

Mandatory

Type

Description

setId

Yes

String

Definition :

Rule set ID. Obtain the ID by calling the API used to obtain the rule set list.

Constraints:

N/A

Value range:

1 to 32 characters.

Default value:

N/A

showToolVersions

No

Array of strings

Definition:

Display version.

Constraints:

N/A

Range:

N/A

Default value:

N/A

criterionIdsList

Yes

Array of CriterionStatusParams objects

Capability rule ID list.

Table 3 CriterionStatusParams

Parameter

Mandatory

Type

Description

id

Yes

String

Definition :

Unique ID of a rule. Obtain the information by calling the API used to obtain the rule list[.

Constraints:

N/A

Value range:

32-character UUID.

Default value:

N/A

status

Yes

String

Definition:

Status.

Constraints:

N/A

Value range:

  • enable: enabled.

  • disable: disabled.

Default value:

N/A

isSupportVersion

No

String

Definition:

Whether version-level check is enabled for the rule. If this parameter is set to disable, the rule does not take effect in the version-level check.

Constraints:

N/A

Value range:

  • enable: enabled.

  • disable: disabled.

Default value:

N/A

isSupportPersonal

No

String

Definition:

Whether the gate-level check is enabled for the rule. If this parameter is set to disable, the rule does not take effect in the gate-level check.

Constraints:

N/A

Value range:

  • enable: enabled.

  • disable: disabled.

Default value:

N/A

isSupportIDE

No

String

Definition:

Whether the IDE-level check is enabled for the rule. This function is not available currently.

Constraints:

N/A

Value range:

  • enable: enabled.

  • disable: disabled.

Default value:

N/A

delayStartTime

No

String

Definition:

Delay alarm start time (UTC). Format: yyyy-MM-ddTHH:mm:ssZ.

Constraints:

The input value must be in the format of yyyy-MM-ddTHH:mm:ssZ.

Range:

N/A

Default value:

N/A

delayEndTime

No

String

Definition:

Delay alarm end time (UTC). Format: yyyy-MM-ddTHH:mm:ssZ.

Constraints:

The input value must be in the format of yyyy-MM-ddTHH:mm:ssZ.

Range:

N/A

Default value:

N/A

options

No

Array of CriterionOptionRequestBody objects

Rule options. Some rules contain configuration parameters that support user-defined values.

severity

No

String

Definition:

Alarm severity.

Constraints:

Only 0, 1, 2, and 3 are supported.

Value range:

  • 0: critical

  • 1: major

  • 2: minor

  • 3: suggestion

Default value:

N/A

Table 4 CriterionOptionRequestBody

Parameter

Mandatory

Type

Description

ruleId

No

String

Definition:

Tool rule ID.

Constraints:

N/A

Value range:

32-character UUID.

Default value:

N/A

criterionId

No

String

Definition:

Unique ID of the capability rule.

Constraints:

N/A

Value range:

32-character UUID.

Default value:

N/A

criterionSetId

No

String

Definition:

Rule set ID.

Constraints:

N/A

Value range:

32-character UUID.

Default value:

N/A

optionKey

No

String

Definition:

Key of a configuration parameter.

Constraints:

N/A

Range:

N/A

Default value:

N/A

name

No

String

Definition:

Option name.

Constraints:

N/A

Range:

N/A

Default value:

N/A

optionValue

No

String

Definition:

Value of the configuration parameter. The value is set by the user. If left blank, the default value will be used.

Constraints:

N/A

Range:

N/A

Default value:

N/A

description

No

String

Definition:

Description of the configuration parameter.

Constraints:

N/A

Range:

N/A

Default value:

N/A

defaultValue

No

String

Definition:

Default value.

Constraints:

N/A

Range:

N/A

Default value:

N/A

valueType

No

String

Definition:

Parameter value type.

Constraints:

N/A

Value range:

  • BOOLEAN: boolean

  • FLOAT: floating point number

  • INTEGER: integer

  • STRING: string

  • If not specified, STRING is used by default.

Default value:

N/A

valueRange

No

String

Definition:

Parameter value range.

Constraints:

N/A

Range:

N/A

Default value:

N/A

Response Parameters

Status code: 200

Table 5 Response body parameters

Parameter

Type

Description

httpStatus

String

Definition:

HTTP response status.

Value range:

  • OK: The request has been successfully processed, and the server returns the requested resource or operation result.

  • ACCEPTED: The request has been accepted by the server, but the processing is not complete (usually used for asynchronous operations).

  • INTERNAL_SERVER_ERROR: internal API exception.

  • BAD_REQUEST: abnormal parameter verification.

result

String

Definition:

Rule update description.

Range:

N/A

status

String

Definition:

API response status.

Value range:

  • success: successful response.

  • error: response failed.

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Definition:

Error code.

Value range:

N/A

error_msg

String

Definition:

Error message.

Value range:

N/A

Status code: 401

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Definition:

Error code.

Value range:

N/A

error_msg

String

Definition:

Error message.

Value range:

N/A

Example Requests

POST https://{endpoint}/v1/relations

{
  "criterionIdsList" : [ {
    "severity" : "2",
    "stage" : "",
    "isSupportPersonal" : "enable",
    "isSupportIDE" : "disable",
    "options" : [ {
      "isDefault" : true,
      "criterionId" : "6de996af6d6511edab16fa163e0fa374",
      "optionKey" : "CheckPtr",
      "editable" : false,
      "defaultValue" : "\"\"",
      "optionValue" : "\"\"",
      "name" : "CheckPtr",
      "description" : "If this parameter is set to true, the check is also performed when the function parameter is a pointer.",
      "ruleId" : "6e0b9ff76d6511edab16fa163e0fa374"
    } ],
    "id" : "6de996af6d6511edab16fa163e0fa374",
    "isSupportVersion" : "enable",
    "status" : "enable"
  } ],
  "setId" : "bdb0ba39e21545b7bf8f1f3b70084bc2",
  "showToolVersions" : [ "202503" ]
}

Example Responses

Status code: 200

Request Succeeded!

{
  "httpStatus" : "OK",
  "result" : "Number of changes: 1",
  "status" : "success"
}

Status code: 400

Bad Request

{
  "error_code" : "CC.xxxxxxxx.400",
  "error_msg" : "Verify request parameter failed. Check whether the request parameters are correct."
}

Status code: 401

Unauthorized

{
  "error_code" : "CC.00000003",
  "error_msg" : "Authentication information expired."
}

Status Codes

Status Code

Description

200

Request Succeeded!

400

Bad Request

401

Unauthorized

Error Codes

See Error Codes.