Querying the Rule Set List
Function
This API is used to query the rule set list based on conditions such as the project ID and language.
URI
GET /v2/{project_id}/rulesets
| 
        Parameter  | 
      
        Mandatory  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|---|
| 
        project_id  | 
      
        Yes  | 
      
        String  | 
      
        Project ID  | 
     
| 
        Parameter  | 
      
        Mandatory  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|---|
| 
        category  | 
      
        No  | 
      
        String  | 
      
        Rule Set Type '0 indicates that only the system rule set is queried. 1 indicates that only the user-defined rule set is queried. 2 indicates that only the user-defined rule sets are queried. '0,1,2' or'Query all'  | 
     
| 
        offset  | 
      
        No  | 
      
        Integer  | 
      
        Pagination index, offset Minimum: 0 Default: 0  | 
     
| 
        limit  | 
      
        No  | 
      
        Integer  | 
      
        Number of records displayed on each page. Minimum: 1 Maximum: 1000 Default: 100  | 
     
Request Parameters
| 
        Parameter  | 
      
        Mandatory  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|---|
| 
        X-Auth-Token  | 
      
        Yes  | 
      
        String  | 
      
        User token. It can be obtained by calling an IAM API. The value of X-Subject-Token in the response header is the user token. Minimum: 1 Maximum: 100000  | 
     
Response Parameters
Status code: 200
| 
        Parameter  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|
| 
        info  | 
      
        Array of RulesetItem objects  | 
      
        Rule Set List Information  | 
     
| 
        total  | 
      
        Integer  | 
      
        Total  | 
     
| 
        Parameter  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|
| 
        template_id  | 
      
        String  | 
      
        Rule Set ID  | 
     
| 
        language  | 
      
        String  | 
      
        Rule Set Language  | 
     
| 
        template_name  | 
      
        String  | 
      
        Rule Set  | 
     
| 
        creator_id  | 
      
        String  | 
      
        Creator ID.  | 
     
| 
        creator_name  | 
      
        String  | 
      
        Creator name  | 
     
| 
        template_create_time  | 
      
        String  | 
      
        Creator Time  | 
     
| 
        is_used  | 
      
        String  | 
      
        Indicates the usage status. 1: in use; 0: idle.  | 
     
| 
        rule_ids  | 
      
        String  | 
      
        ID of a rule in a rule set.  | 
     
| 
        is_default  | 
      
        String  | 
      
        Indicates whether the default rule set of the language is used. 0: no; 1: yes  | 
     
| 
        is_devcloud_project_default  | 
      
        String  | 
      
        Indicates whether the rule set is the default rule set of the language in the project. 0: no; 1: yes.  | 
     
| 
        is_default_template  | 
      
        String  | 
      
        Indicates whether the rule set is a system rule set. 0: no; 1: yes.  | 
     
Status code: 400
| 
        Parameter  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|
| 
        error_code  | 
      
        String  | 
      
        Error Codes  | 
     
| 
        error_msg  | 
      
        String  | 
      
        Description  | 
     
Status code: 401
| 
        Parameter  | 
      
        Type  | 
      
        Description  | 
     
|---|---|---|
| 
        error_code  | 
      
        String  | 
      
        Error Codes  | 
     
| 
        error_msg  | 
      
        String  | 
      
        Description  | 
     
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" : "The network is busy. Please try again later."
}
  Status code: 401
Unauthorized
{
  "error_code" : "CC.00000003",
  "error_msg" : "The authentication information has expired."
}
 Status Codes
| 
        Status Code  | 
      
        Description  | 
     
|---|---|
| 
        200  | 
      
        Request succeeded!  | 
     
| 
        400  | 
      
        Bad Request  | 
     
| 
        401  | 
      
        Unauthorized  | 
     
Error Codes
See Error Codes.
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.