How to import rules from command line

Started by Peter


How to import rules from command line   10 January 2018, 23:33

I am trying to setup Bandwidth Manager configuration from script. Is there any way to import the rule from command line?
SoftPerfect Support forum - Ann avatar image

Re: How to import rules from command line   10 January 2018, 23:58

There is a couple of ways to do it, but not via command line parameters:

1. Direct reading/writing of the database. We use a standard SQLite 3 database that can be read and written from many programming languages and environments. You can find it via the path shown under the Storage tab in menu File - Settings.

Grab any SQLite management tool like SQLiteSpy and you can read this database. Rules are stored in the RULE table and you will need to restart the service after any changes.

2. There is an XML-based protocol and you can use cURL to send data to the service. Below is an input example and a rule template attached. For a custom rule, you can create a rule you need, copy it to the clipboard and paste into a text editor. Then take the contents between the <root> tags and insert it between the <item> tags, as it was done in the example.

cURL console input:
curl -X POST --header "Content-Type:text/xml;charset=UTF-8" --data-binary @file.xml admin@localhost:8701
The response will be something like this:
The status value of 1 indicates success, while a 0 indicates failure. In case of a failure, the message tag will contain an error message.
open | download – (694 bytes)

Reply to this topic

Sometimes you can find a solution faster if you try the forum search, have a look at the knowledge base, or check the software user manual to see if your question has already been answered.

Our forum rules are simple:

  • Be polite.
  • Do not spam.
  • Write in English. If possible, check your spelling and grammar.




A brief and informative title for your message, approximately 4–8 words:


Spam prevention: please enter the following code in the input field below.

       **        **  **     **  **     **  **        
       **        **  ***   ***  **     **  **    **  
       **        **  **** ****  **     **  **    **  
       **        **  ** *** **  *********  **    **  
 **    **  **    **  **     **  **     **  ********* 
 **    **  **    **  **     **  **     **        **  
  ******    ******   **     **  **     **        **