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

Viewing Rules of a Rule Set

Function

This API is used to query the rules in a rule set of a project. You can filter rules by rule status.

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::getRuleSet

Read

-

-

-

-

URI

GET /v2/{project_id}/ruleset/{ruleset_id}/rules

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition :

You can obtain the 32-character UUID by calling the API used to query the project list.

Constraints:

N/A

Value range:

32-character project ID.

Default value:

N/A

ruleset_id

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

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

types

No

String

Definition:

Rule status.

Constraints:

N/A

Value range:

  • 1: Query all rules.

  • 2: Query enabled rules.

  • 3: Query disabled rules.

Default value:

1

languages

No

String

Definition

Rule language.

Constraints

N/A

Range

N/A

Default Value

N/A

tags

No

String

Definition

Rule tag.

Constraints

N/A

Range

N/A

Default Value

N/A

offset

No

Integer

Definition

Offset for pagination.

Constraints

N/A

Range

0–999

limit

No

Integer

Definition

Number of records displayed on each page.

Constraints

N/A

Range

0–200

Request Parameters

Table 3 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

Response Parameters

Status code: 200

Table 4 Response body parameters

Parameter

Type

Description

info

Array of RuleItem objects

Definition

Rules of a rule set.

Range

N/A

total

Integer

Definition

Total number.

Range

N/A

Table 5 RuleItem

Parameter

Type

Description

rule_id

String

Definition:

Rule ID.

Value range:

32-character ID.

rule_language

String

Definition:

Rule language.

Value range:

The following languages are supported:

  • ArkTS

  • C#

  • Cangjie

  • C++

  • CSS

  • Go

  • HTML

  • Java

  • JavaScript

  • Kotlin

  • Lua

  • PHP

  • Python

  • Rust

  • Scala

  • Shell

  • SQL

  • Terraform

  • TypeScript

rule_name

String

Definition

Rule name.

Range

N/A

rule_severity

String

Definition:

Issue severity.

Value range:

  • 0: critical

  • 1: major

  • 2: minor

  • 3: suggestion

tags

String

Definition:

Rule tag.

Value range:

  • huawei

  • iso5055

  • cert

  • cwe

  • top10

  • top25

  • misra

  • GJB

  • autosar

  • PCI DSS

checked

String

Definition:

Rule status.

Value range:

  • 0: disabled

  • 1: enabled

rule_config_list

Array of RuleConfigParam objects

Rule threshold information.

Table 6 RuleConfigParam

Parameter

Type

Description

id

Integer

Definition :

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

Value range:

32-character UUID.

rule_id

String

Definition:

Tool rule ID, that is, the ID of a threshold for configuring a threshold rule. To obtain such an ID, contact customer service.

Value range:

32-character UUID.

default_value

String

Definition

Default threshold.

Range

N/A

option_value

String

Definition

New threshold of a parameter.

Range

N/A

option_key

String

Definition :

Key of the current rule configuration item. Obtain the ID by calling the API used to obtain the rule list[.

Value range:

N/A

option_name

String

Definition :

Key of the current rule configuration item. Obtain the ID by calling the API used to obtain the rule list[.

Value range:

N/A

template_id

String

Definition :

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

Value range:

32-character UUID.

description

String

Definition

Parameter description. This parameter is optional.

Range

N/A

Status code: 400

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

Status code: 401

Table 8 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

GET https://{endpoint}/v2/{project_id}/ruleset/{ruleset_id}/rules

Example Responses

Status code: 200

Request succeeded!

{
  "info" : [ {
    "rule_language" : "cpp",
    "rule_id" : "1614",
    "checked" : "1",
    "rule_name" : "A buffer must have size of 2 integers if used as parameter of pipe().",
    "rule_severity" : "1",
    "tags" : "cwe",
    "rule_config_list" : [ ]
  }, {
    "rule_language" : "cpp",
    "rule_id" : "1611",
    "checked" : "1",
    "rule_name" : "A buffer must have size of 2 integers if used as parameter of pipe().",
    "rule_severity" : "1",
    "tags" : "cwe",
    "rule_config_list" : [ {
      "id" : 250,
      "rule_id" : 11707,
      "template_id" : "906e7eac47dd4bde9c984f5e6f2a54e8",
      "option_key" : "threshold",
      "option_name" : "Adding a threshold",
      "option_value" : "10",
      "default_value" : "20",
      "description" : "If the code complexity exceeds the threshold, the code is identified as a huge cyclomatic complexity. The difference between the large cyclomatic complexity and cyclomatic complexity statistics is that only the number of switch statements is counted. The parameter is mandatory."
    }, {
      "id" : 251,
      "rule_id" : 11707,
      "template_id" : "906e7eac47dd4bde9c984f5e6f2a54e8",
      "option_key" : "threshold_modify",
      "option_name" : "Modifying a threshold",
      "option_value" : "30",
      "default_value" : "20",
      "description" : "If the code complexity exceeds the threshold, the code is identified as a huge cyclomatic complexity. The difference between the large cyclomatic complexity and cyclomatic complexity statistics is that only the number of switch statements is counted. The modified threshold must be greater than the new threshold. This parameter is optional."
    } ]
  } ],
  "total" : 2
}

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.