How to deploy/undeploy rulebases from command line
                    
                
                
                    
                        book
                        
Article ID: KB0076143
                        
                    
                    
                        calendar_today
                        
Updated On: 
                    
                 
                
                
                
                    
                
                    
                    
                    
                    
                        
                            
Description
                        
                        
                            Some customers have requirement that rulebases could be managed from command line. For example: list, deploy, undeploy, etc...
In the past, customer has to use hawk console api to program by themselves. Now here is an easy to achieve this, hawk 6.2 provides REST API which can be used for rulebase management from command line. 
Since hawk 6.2 is backward compatible, this solution also works for Hawk 5.2 and Domain Hawkagent.
                         
                     
                    
                    
                        
                        
                    
                    
                        
                            
                                
Resolution
                            
                            
                                Steps:
1. Install standalone hawk 6.2 on any box, then configure HawkConsole component, connect to hawk domain(s);
2. Logon HawkConsole from web browser to verify that HawkConsole is started and connected to domain(s):
http://<Hostname/IP>:8083/HawkConsole/dist/#/home
 3. Use curl command to invoke REST API. (on windows you may need cygwin)
Get rulebase list:
curl -u admin:admin --request GET http://<Hostname/IP>:8083/HawkConsole/{domain}/{dns}/{agent}/Rulebase
# -u user:password, here is the credential for HawkConsole, by default it's admin:admin
 
 Import hrb file:
curl -u admin:admin --request POST http://<Hostname/IP>:8083/HawkConsole/{domain}/{dns}/{agent}/Rulebase/import -F "file=@/full/path/demo.hrb" 
Deploy rulebase:
curl -u admin:admin --request POST http://<Hostname/IP>:8083/HawkConsole//{domain}/{dns}/{agent}/Rulebase/{rulebase}/deploy
Undeploy rulebase:
curl -u admin:admin --request POST http://<Hostname/IP>:8083/HawkConsole//{domain}/{dns}/{agent}/Rulebase/{rulebase}/undeploy
For more options, see here:
http://<Hostname/IP>:8083/HawkConsole/v1/docs
                             
                         
                        
                    
                        
                            
                                
Issue/Introduction
                            
                            
                                Manage rulebase from command line
                            
                         
                        
                    
                    
                    
                
                    
                        
                            Was this article helpful?
                        
                        
                            
                                thumb_up
                                Yes
                            
                            
                                thumb_down
                                No