# 追加节点的测试规则 (在现有测试规则尾部追加新的测试规则)

# 调用方式: PUT

# 接口地址:

https://api.freelog.com/v2/testNodes/{nodeId}/rules
1

# url传入参数说明:

参数 必选 类型及范围 说明
nodeId 必选 int 节点ID

# body传入参数说明:

参数 必选 类型及范围 说明
additionalTestRule 必选 string 追加的测试规则文本,encodeURIComponent编码

# body示例

{
  "testRuleText":"add%20%20%24yuliang%2F%E9%A3%8E%E6%99%AF%E5%9B%BE%20as%20import_test_resource%0Ado%0A%20%20%20set_labels%20tag1%2Ctag2%2Ctag3%09%09%0Aend%0Aadd%20%20%20%23yuliang-a%2Fyuliang-4131%20%20as%20object_1%20%0Ado%20%20%0A%20%20%20set_labels%20reset%20%20%0A%20%20%20replace%20%23yuliang%2Freadme2%20with%20%23yuliang%2Freadme3%20%20%0A%20%20%20hide%20%0Aend"
}
1
2
3

# 返回说明:

返回值字段 字段类型 字段说明
userId int 创建方案的用户ID
nodeId int 节点ID
ruleText string 规则文本
status int 匹配状态1:匹配中 2:匹配失败 3:匹配成功
testRules object[] 测试规则集合
** id string 规则ID
** text string 规则原文
** matchErrors string[] 规则匹配时的错误信息
** ruleInfo object 规则具体信息(见下面ruleInfo实体说明)
** efficientInfos object[] 匹配生效次数
**** type string 规则对应的操作,例如add,alter,setTags,setOnlineStatus,replace,setAttr,setCover,setTitle,replace
**** count int 生效次数

# 实体ruleInfo说明:

返回值字段 字段类型 字段说明
operation string 操作类型,包含add,alter,activate_theme
labels string[] add资源或者set时,设置的标签
online bool? 是否上线,null值表示未设置
exhibitName string 指定作用的测试资源名称
candidate object add资源时的候选目标对象信息
** name string 候选资源或对象名称
** type string 候选目标类型,object或resource
** versionRange string 候选目标的版本范围,对象无此属性
replaces object[] 替换信息对象集合
** replaced object replace时的被替代者信息
**** name string 被替代者名称
**** type string 被替代者类型
**** versionRange string 被替代者版本范围
** replacer object replace时的替代者信息
**** name string 替代者名称
**** type string 替代者类型
**** versionRange string 替代者版本范围
** scopes object [] 替换操作时的作用范围
**** name string 上游依赖树节点的资源名称
**** type string 上游依赖树节点资源类型
**** versionRange string 上游依赖树节点资源版本范围

# 返回示例

{
    "ret": 0,
    "errCode": 0,
    "errcode": 0,
    "msg": "success",
    "data": {
        "ruleText": "add  $yuliang/风景图 as import_test_resource\ndo\n   set_labels tag1,tag2,tag3\t\t\nend\nadd   #yuliang-a/yuliang-4131  as object_1 \ndo  \n   set_labels reset  \n   replace #yuliang/readme2 with #yuliang/readme3  \n   hide \nend",
        "themeId": "",
        "status": 1,
        "matchResultDate": null,
        "_id": "600500e24bb9f4472c872868",
        "nodeId": 80000000,
        "userId": 50021,
        "testRules": [
            {
                "matchErrors": [],
                "efficientInfos": [],
                "id": "c91c561bb160c49f067fbb8435d5d3dc",
                "ruleInfo": {
                    "text": "add  $yuliang/风景图 as import_test_resource\ndo\n   set_labels tag1,tag2,tag3\t\t\nend",
                    "operation": "add",
                    "candidate": {
                        "name": "yuliang/风景图",
                        "versionRange": "latest",
                        "type": "resource"
                    },
                    "exhibitName": "import_test_resource",
                    "labels": [
                        "tag1",
                        "tag2",
                        "tag3"
                    ]
                }
            },
            {
                "matchErrors": [],
                "efficientInfos": [],
                "id": "d637ffc311a35f04f488682c05adf9c9",
                "ruleInfo": {
                    "text": "add   #yuliang-a/yuliang-4131  as object_1 \ndo  \n   set_labels reset  \n   replace #yuliang/readme2 with #yuliang/readme3  \n   hide \nend",
                    "operation": "add",
                    "candidate": {
                        "name": "yuliang-a/yuliang-4131",
                        "type": "object"
                    },
                    "exhibitName": "object_1",
                    "labels": [
                        "reset"
                    ],
                    "replaces": [
                        {
                            "replaced": {
                                "name": "yuliang/readme2",
                                "type": "object"
                            },
                            "replacer": {
                                "name": "yuliang/readme3",
                                "type": "object"
                            },
                            "scopes": []
                        }
                    ],
                    "online": false
                }
            }
        ],
        "createDate": "2021-01-18T03:30:42.099Z",
        "updateDate": "2021-01-20T03:28:11.030Z"
    }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70