Home
Help
Search
Login
Register
OPNsense Forum
»
English Forums
»
General Discussion
»
Assistance with Adding a trafficshaper through Rest API
« previous
next »
Print
Pages: [
1
]
Author
Topic: Assistance with Adding a trafficshaper through Rest API (Read 1921 times)
barryfo
Newbie
Posts: 4
Karma: 0
Assistance with Adding a trafficshaper through Rest API
«
on:
March 08, 2019, 06:08:23 pm »
Hi All,
I have been trying to find the correct format for the trafficshaper APIs. The only result I ever get is "failed" which is basically any validation failure. Trying to parse through the code and haven't had any luck getting the right combination. As anyone added pipes, queues, and rules via Rest?
An example of one of my attempts:
curl -v -XPOST -d '{"number":"100","enabled":"1","bandwidth":"300","bandwidthMetric":"Kbit","mask":"none","codel_enable":"0","codel_ecn_enable":"0","pie_enable":"0","description":"TestPipe"}' -H "Content-Type: application/json" -k -u "<Key>":"<secret>"
https://192.168.1.1/api/trafficshaper/settings/addpipe
{"result":"failed"}
Logged
sdelaney01
Newbie
Posts: 1
Karma: 0
Re: Assistance with Adding a trafficshaper through Rest API
«
Reply #1 on:
February 01, 2023, 04:20:51 pm »
I've been having the same issue, and took a while to go through the forum.
This topic has the solution:
https://forum.opnsense.org/index.php?topic=30356.msg146448#msg146448
But for sake of completeness, your JSON body should look this this:
'{"pipe":{"number":"100","enabled":"1","bandwidth":"300","bandwidthMetric":"Kbit","mask":"none","codel_enable":"0","codel_ecn_enable":"0","pie_enable":"0","description":"TestPipe"}}'
Logged
saleh
Newbie
Posts: 6
Karma: 0
Re: Assistance with Adding a trafficshaper through Rest API
«
Reply #2 on:
September 09, 2024, 11:03:25 pm »
Is there any example for JSON body for addRule?
Thank you
Logged
Print
Pages: [
1
]
« previous
next »
OPNsense Forum
»
English Forums
»
General Discussion
»
Assistance with Adding a trafficshaper through Rest API