Art-of-WiFi / UniFi-API-client

A PHP API client class to interact with Ubiquiti's UniFi Controller API
MIT License
1.09k stars 217 forks source link

setting a rule #181

Closed jtolksdo closed 4 months ago

jtolksdo commented 1 year ago

Hi, apologies, I'm lost. Is there a function which allows me to set an existing traffic rule to "allow" or "block"? Thanks a million!

malle-pietje commented 1 year ago

Which "Traffic Rules" do you mean exactly?

jtolksdo commented 1 year ago

@malle-pietje thanks for the swift reply. On my Dream Machine I can go in settings to "Traffic Management". There, I can define "Traffic Rules" and set them to "allow" or "block. image

malle-pietje commented 1 year ago

OK, so they changed the terminology used for "Traffic Restrictions" with version 7.2... Need to find the time to check whether this also involves new API routes.

jtolksdo commented 1 year ago

you rock! Thank you!

Brovning commented 1 year ago

Hello, any updates on this topic?

malle-pietje commented 1 year ago

Had a first look and the basic logic looks quite straightforward. Need to figure out how to document this because of the applications and application groups. The names mappings for these still aren’t available through the API and without that information it’s going to be pretty tricky to use…

Any suggestions?

Brovning commented 1 year ago

The user has to click on edit, so that he can copy the unique ruleID from the URL: image

Afterwards your implemented function for "pausing" the referred traffic rule with ruleID can be used.

I think, that this would be the easiest approach...