Rule Export API

I am looking for a way to export all of the rules in the tenant so we can have source control or any changes.

I tried using the /beta/sp-config/export with “RULE” but in one tenant this only gave 21 rules but I know there are more. I used an older API /api/rule/list and this returned 77 for the same tenant.

Are one of these 2 APIs the best way to accomplish this or is there another that would work better?

Hi,

please use the older API, new API is a beta version.

Hello,
If you are using this for an automated source control process we recommend using the v3 API as the beta API’s are still under development and subject to change without notice. Did the v3 API call return all of the expected rules in your testing?
Regards,
-Chris Smith

Is there a v3 API for getting Rules?

The rules an API export call will return depends on what version of the API the rules were originally submitted with, so if these rules were submitted on the v1 API that is why they would not show up in your beta v3 export call. The 21 rules that did show up in your call are showing up because they were originally uploaded with the v3 API.
I hope this is helpful in explaining the behavior you are seeing.
Regards,
-Chris Smith

Hello @ethompson, was the information provided in our earlier responses helpful in solving your problem? Don’t hesitate to let us know if you have any other questions!

  • Chris