Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Advisor

Creation of multiple rules at once

Dear all,

I am in the process of creating a new policy package, where I have to add ~140 rules and would like to do it via API.

I have managed to create the correct format of the API call that add a access rule, but cannot figure out, how to add multiple rules at once. I can only do, one by one. ( ignore the hosts/service names, those exist on the domain )

rule no 1:

 

{
"layer" : "Standard Network",
"position" : "top",
"source": ["Host1-A"],
"destination": ["Host1-B"],
"service" : ["ghttp", "ghttps", "gFileShare"],
"action" : "Accept",
"track" : {
     "type": "log"
     }
}

 

rule no 2:

 

{
"layer" : "Standard Network",
"position" : "bottom",
"source": ["Host2-A", "Host1-C"],
"destination": ["Host2-A", "Host2-C"],
"service" : ["gsmtp", "gssh", "ghttps", "ghttp"],
"action" : "Accept",
"track" : {
     "type": "log"
     }
}

 

rule no 3:

 

{
"layer" : "Standard Network",
"position" : "bottom",
"source": ["Host1-D"],
"destination": ["Host2-D"],
"service" : ["gicmp", "ghttps"],
"action" : "Accept",
"track" : {
     "type": "log"
     }
}

 

 

 If i add them like this, i don't get them all after the publish, and I think it's because of the position argument which is required and i have bottom on 2 rules.

 

{
rule no1
},
{
rule no2 
},
{
rule no3
}

 

Any ideas?


BR,
Paul

0 Kudos
Reply
4 Replies
Highlighted
Advisor

I'm sorry, I've overseen the value for position : integerDescription: Add rule at the specific position ) ...

0 Kudos
Reply
Highlighted
Advisor

I've implemented for each rule a position number, which is unique, starts with 1 and increments until the last rule is generated, so no overlap.

Cannot seem to add multiple rules at once, only 1 by 1. Is this how is supposed to work? I know that the API call states, add-access-rule and not add-access-rules, but still... I was expecting to be able to bulk add my rules.
Any ideas if the posibility of adding multiple rules via API is something that will be available in the future ?

0 Kudos
Reply
Highlighted
Champion
Champion

This is the way it works in programming language - you have to repeat adding an object to add more than one object 😎. But you can write a function that takes a list of rules to bulk add and perform it (one by one)...

0 Kudos
Reply
Highlighted
Admin
Admin

Yes, you add one rule at a time.
Thats precisely how the API works.

0 Kudos
Reply