Hi,
There is no good way to export the rules. It’s not something we ever anticipated needed to do. We suggest you start from the Sonar way profiles. Run them on your code, see what you get and go from there.
If you feel you really must do this, then take a look at the Web API. The best way to master the API is to perform the desired action via the UI and eavesdrop to see which calls the UI made to accomplish the action.
You may also find this guide helpful.
HTH,
Ann