Updated on 2025-08-21 GMT+08:00

Querying Rule Sets

Function

This API is used to query rule sets based on conditions such as the project ID and language.

Calling Method

For details, see Calling APIs.

URI

GET /v2/{project_id}/rulesets

Table 1 Path Parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Definition

32-character UUID of a project. Obtain the ID by calling the API for querying projects.

Constraints

N/A

Range

32-character project ID.

Default Value

N/A

Table 2 Query Parameters

Parameter

Mandatory

Type

Description

category

No

String

Definition

Rule set category.

Constraints

N/A

Range

  • 0: Query only the system rule sets.

  • 1: Query only the rule sets of the current user.

  • 2: Query only the rule sets of other users.

Separate multiple values with commas (,).

Default Value

0,1,2 All rule sets are queried by default.

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–100

need_selected_status

No

String

Definition

Whether to query the usage status of a rule set.

Constraints

N/A

Range

  • true: Query the usage status of a rule set.

  • false: Do not query the usage status of a rule set. All rule sets are returned as unused.

Request Parameters

Table 3 Request header parameters

Parameter

Mandatory

Type

Description

X-Auth-Token

Yes

String

Definition

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

Constraints

N/A

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 RulesetItem objects

Definition

Rule set list.

Range

N/A

total

Integer

Definition

Total number of rule sets.

Range

N/A

Table 5 RulesetItem

Parameter

Type

Description

template_id

String

Definition

Rule set ID.

Range

32-character UUID.

language

String

Definition

Rule set language.

Range

Supported languages include: ArkTS, C#, C++, CSS, Go, HTML, Java, JavaScript, Kotlin, Lua, PHP, Python, Rust, Scala, Shell, SQL, and TypeScript.

template_name

String

Definition

Rule set language.

Range

Can contain any letters, digits, periods (.), hyphens (-), and underscores (_).

creator_id

String

Definition

The user_id of the creator. The value is an IAM user ID.

Range

32-character UUID.

creator_name

String

Definition

Creator name. The value is an IAM username.

Range

IAM username.

template_create_time

String

Definition

Creation time. Use the time zone 00:00.

Range

Time of time zone 00:00.

is_used

String

Definition

Usage status.

Range

  • 0: idle

  • 1: in use

rule_ids

String

Definition

The ID of a rule in the rule set. Each rule has a unique ID.

Range

List of 32-character UUIDs. Separate multiple UUIDs with commas (,).

is_default

String

Definition

Whether the rule set is the default for the language.

Range

  • 0: no

  • 1: yes

is_devcloud_project_default

String

Definition

Whether the rule set is the default for the language in the project.

Range

  • 0: no

  • 1: yes

is_default_template

String

Definition

Whether the rule set is preconfigured by the system.

Range

  • 0: no

  • 1: yes

Status code: 400

Table 6 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Status code: 401

Table 7 Response body parameters

Parameter

Type

Description

error_code

String

Error code.

error_msg

String

Error message.

Example Requests

GET https://{endpoint}/v2/{project_id}/rulesets

Example Responses

Status code: 200

Request succeeded!

{
  "info" : [ {
    "template_id" : "9698e0cb9d2441c3bd8cec5f8641696e",
    "language" : "Java",
    "template_name" : "test1111",
    "creator_id" : "ae161856f2604229ae12056478a7919f",
    "creator_name" : "Mr. Yang",
    "template_create_time" : "2021-10-21T02:14:55Z",
    "is_used" : "0",
    "rule_ids" : "",
    "is_default" : "0",
    "is_default_template" : "1",
    "is_devcloud_project_default" : "0"
  }, {
    "template_id" : "9698e0cb9d2441c3bd8cec5f8641696e",
    "language" : "cpp",
    "template_name" : "test222",
    "creator_id" : "ae161856f2604229ae12056478a7919f",
    "creator_name" : "Mr. Yang",
    "template_create_time" : "2021-10-21T02:14:55Z",
    "is_used" : "1",
    "rule_ids" : "11152,11153,11154,11155",
    "is_default" : "0",
    "is_default_template" : "1",
    "is_devcloud_project_default" : "1"
  } ],
  "total" : 2
}

Status code: 400

Bad Request

{
  "error_code" : "CC.00000000",
  "error_msg" : "Network busy. Try again later."
}

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.