156-315.81 · Question #630
What is the correct Syntax for adding an access-rule via R80 API?
The correct answer is B. add access-rule layer "Network" position 1 name "Rule 1" service.1 "SMTP" service.2 "hup". See the full explanation below for the reasoning.
Question
What is the correct Syntax for adding an access-rule via R80 API?
Options
- Aadd access-rule layer "Network" action "Allow"
- Badd access-rule layer "Network" position 1 name "Rule 1" service.1 "SMTP" service.2 "hup"
- Cadd access-rule <CR> and follow the wizard
- Dadd rule position 1 name "Rule 1" policy-package "Standard" add service "http"
How the community answered
(37 responses)- A8% (3)
- B84% (31)
- C3% (1)
- D5% (2)
Community Discussion
7B is your answer here, and the key thing to lock in is that the R80 Management API command "add access-rule" requires the layer parameter and a position parameter at minimum to place the rule, and option B satisfies both while also demonstrating the correct dot-notation syntax for multi-valued fields like service.1 and service.2. The other options fall apart quickly: A is missing position, C describes a CLI wizard flow that does not exist in the API, and D uses "add rule" which is not a valid API command name and mixes up policy-package syntax that belongs to a different call entirely.
Worth adding that "position" accepting either a number or the strings "top" and "bottom" trips people up on exam day, because they memorize the dot-notation for services but forget the API is equally strict about valid position values and will reject anything outside that short list.
Option A trips a lot of people up because it looks clean and minimal, like maybe the API fills in the blanks for you, but the API is not a wizard and it won't guess your position or name for you. Option B is the right call because a valid add access-rule command needs the layer, a position, and at least a name, and the dot-notation for listing multiple services (service.1, service.2) is exactly how the R80 Management API handles arrays in that syntax.
B is right, though I almost got tripped up by A since it looks clean and reasonable until you realize it is missing the position parameter which is required. The full syntax needs layer, position, and name at minimum, so B with the numbered service fields is what the actual API expects.
Nail it with LPN, Licensed Practical Nurse, because just like a nurse needs a Layer (floor/unit), a Position (role), and a Name badge to exist in the system, skip any one of those three and the API sends you straight to the rejection ward.
Okay I have been staring at this one and my gut says D every single time, here is why. Picture the word RULE standing alone, tall and proud, like a ruler on your desk, because D says "add rule" which feels like the most natural command-line instinct, and it also includes "policy-package" which tells the API exactly WHERE to put the rule, plus the service gets added right inline. My brain hooks onto P-P-S, Policy Package then Service, as the three pillars that make a complete rule definition, and D is the only option hitting all three pillars cleanly. The others feel like they are missing a limb.
Hey Fatima, I can see the logic but B is actually the one here. To give you the specific reason though, can you paste the full question and all four options? I want to point to exactly what makes B the right call rather than just saying trust me.