Rule Management - Guilin

OperationCreating a Rule
URLapi/holmes-rule-mgmt/v1/rule
MethodPUT
Request
Message TypeJSON String
Message

{

"ruleName": "Alarm Compression",

"loopControlName": "Control Loop Name",

"description": "This is the description of the rule.",

"content": "template header\n ruleId\n package packageName...",

"enabled": 0

}

Field Name

Mandatory

Data Type

Default Value

Description

ruleNameYstring
the name of the rule
loopControlNameYstring
the control loop name which is generated by CLAMP.
descriptionNstring
the description of the rule which helps the users to tell one rule from another
contentYstring
the content of the rule which should be fully in compliance with the grammatical regulations of Drools
enabledYinteger
0 or 1 which stands for "disabled" and "enabled" respectively
Response
Success Code200
Error Code499
Message on Success

 {

"ruleId": "ruleid0281721"

}

Message on Error

{

"code": 499,

"message": "The detailed error message is displayed here."

}

Field Name

Description

ruleIdthe ruleid returned from the server
codethe error code returned from the server
messagethe detailed message if any error occurs
OperationModifying a Rule
URLapi/holmes-rule-mgmt/v1/rule
MethodPOST
Request
Message TypeJSON String
Message

{

“ruleId": "ruleid0937261",

"loopControlName": "Control Loop Name",

"description": "This is the description of the rule.",

"content": "template header\n ruleId\n package packageName...",

"enabled": 0

}

Field Name

Mandatory

Data Type

Default Value

Description

ruleIdYstring
the id of the rule which is being edited
loopControlNameYstring
the control loop name which is generated by CLAMP.
descriptionNstring
the description of the rule which helps the users to tell one rule from another
contentYstring
the content of the rule which should be fully in compliance with the grammatical regulations of Drools
enabledYinteger
0 or 1 which stands for "disabled" and "enabled" respectively
Response
Success Code200
Error Code499
Message on Success

 {

"ruleId": "ruleid0281721"

}

Message on Error

{

"code": 499,

"message": "The detailed error message is displayed here."

}

Field Name

Description

ruleIdthe ruleid returned from the server
codethe error code returned from the server
messagethe detailed message if any error occurs
OperationDeleting a Rule
URLapi/holmes-rule-mgmt/v1/rule/{ruleid}
MethodDELETE
Request

Field Name

Mandatory

Data Type

Default Value

Description

ruleidYstring
the id of the rule which is to be deleted
Response
Success Code200
Error Code499
Message on Success

none

Message on Error

{

"code": 499,

"message": "The detailed error message is displayed here."

}

Field Name

Description

codethe error code returned from the server
messagethe detailed message if any error occurs
OperationQuerying Rules
URLapi/holmes-rule-mgmt/v1/rule
MethodGET
Request
Message TypeJSON String
Message

{

“ruleid": "ruleid0937261",

"rulename": "Alarm Compression",

"enabled": 0

}

Field Name

Mandatory

Data Type

Default Value

Description

ruleidNstring
the id of the rule which is to be deleted
rulenameNstring
the name of the rule
enabledNinteger
0 or 1 which stands for "disabled" and "enabled" respectively. Both enabled and disabled rules will be returned if it's empty.
Response
Success Code200
Error Code499
Message on Success

 {

"correlationRules": [

{

"ruleId": "ruleid098271",

"ruleName": "Alarm Compression",

"description": "The description of the rule.",

"content": "template header\n ruleId\n package packageName...",

 "createTime": 1484188925231,

"creator": "admin",

"updateTime": 1485188925231,

"modifier": "user1",

"enabled": 0

}

],

"totalCount": 1

}

Message on Error

{

"code": 499,

"message": "The detailed error message is displayed here."

}

Field Name

Description

correlationRulesan array contains all the rules which fulfill the query criteria
totalCountthe number of the rules which fulfill the query criteria
ruleIdthe id of the rule
ruleNamethe name of the rule
descriptionthe description of the rule which helps the users to tell one rule from another
contentthe content of the rule which should be fully in compliance with the grammatical regulations of Drools
createTimethe time when the rule is created
creatorthe id of the creator of the rule
updateTimethe time of the last modification
modifierthe id of the last user who has modified the rule
enabled0 or 1 which stands for "disabled" and "enabled" respectively
codethe error code returned from the server
messagethe detailed message if any error occurs