Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API - TrafficShaping: flushreload #7014

Closed
gravitytechau opened this issue Nov 16, 2023 · 8 comments
Closed

API - TrafficShaping: flushreload #7014

gravitytechau opened this issue Nov 16, 2023 · 8 comments
Labels
support Community support

Comments

@gravitytechau
Copy link

G'day,

As detailed here: https://forum.opnsense.org/index.php?topic=36472.msg178089 I'm trying to use the OPNSense API to enable/disable Traffic Shaping rules. Before I make a bug about this not working, I thought I'd bring the question here to ensure I haven't got the wrong end of the functionality stick on flushreload (/api/trafficshaper/service/flushreload) as the forum post has gone a month with no response.

Both the reading & toggling of the rule's active state is successful via the API, but flushreload doesn't apply them to the functioning rules. (What I really need amounts to the "Apply" button in the GUI.)

So, questions!

  1. As implied above - is flushreload intended to give me the functionality I'm hoping for.
  2. If not, what should I be using to enact the change?
  3. Is there some other API call that will suffice if this one isn't functional?

As far as testing goes, I haven't rebooted the system to see if that also applies the change, but as noted in the forum post, pressing Apply on the GUI page does.

Thanks in advance for your help/clarification.

@gravitytechau gravitytechau added the support Community support label Nov 16, 2023
@AdSchellevis
Copy link
Member

The trick to find the correct endpoint usually is to check the browser network inspector, hitting apply calls : /api/trafficshaper/service/reconfigure

@gravitytechau
Copy link
Author

Ah! The data-endpoint attribute on the Apply button! I had looked for forms and the JS event, but I didn't notice that.

... how didn't I notice that? *cleans glasses furiously*

I will test.

@gravitytechau
Copy link
Author

Ok, Good News Everybody (.jpg), that has achieved my goal. So it wasn't a bug, it was a lack of understanding (documentation?) of the ServiceController commands.

Was there a section in the documentation I missed detailing what we've found here?

Will update the Forum post to reflect the solution.

@AdSchellevis
Copy link
Member

We don't detail endpoints as this means a lot of "double documenting" with the risk of getting out of sync, since usage is easy to find, that's usually the fastest anyway. The number of unused endpoints on our end is very low.

@gravitytechau
Copy link
Author

That's totally understandable. Given the nature of the project and the number of people involved.

Is there anywhere in the preamble to the API that notes how to find endpoints as you noted above for this case? (if not, then that'd probably be helpful.)

@AdSchellevis
Copy link
Member

I've checked the docs, but I don't think the simple trick is explained somewhere at the moment, we might consider adding it to https://docs.opnsense.org/development/api.html as that's likely the first place people will look for it.

@gravitytechau
Copy link
Author

Good idea.

Hopefully people will actually read that section in full ;)

AdSchellevis added a commit to opnsense/docs that referenced this issue Nov 20, 2023
@AdSchellevis
Copy link
Member

well, at least we can point them to there 🙃 this opnsense/docs@ea8d486 should help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support Community support
Development

No branches or pull requests

2 participants