Difference between revisions of "Traffic Groups Using The API"
Line 1: | Line 1: | ||
[[Category:API]] | [[Category:API]] | ||
− | It is possible to provision and remove Traffic Groups from the GigaFlow server via the rest API using the following requests | + | It is possible to provision and remove Traffic Groups from the GigaFlow server via the rest API using the following requests. |
− | + | Add a new TrafficGroup called "Office_2" with no description, a starting IP of 172.21.40.101 and an ending IP of "172.21.40.254"; it will also set the group to only accept flows from the 3 listed devices: | |
{"type":"addtrafficgroup","groups":[{"name":"Office 7_2","description":"","startip":"172.21.40.101","endip":"172.21.40.254","natted":false,"devices":["172.21.40.254","83.70.199.180","172.21.40.199"]}]} | {"type":"addtrafficgroup","groups":[{"name":"Office 7_2","description":"","startip":"172.21.40.101","endip":"172.21.40.254","natted":false,"devices":["172.21.40.254","83.70.199.180","172.21.40.199"]}]} | ||
− | If you do not want to assign any devices, you can skip that parameter completely | + | If you do not want to assign any devices, you can skip that parameter completely: |
{"type":"addtrafficgroup","groups":[{"name":"Office 7_2","description":"","startip":"172.21.40.101","endip":"172.21.40.254"}]} | {"type":"addtrafficgroup","groups":[{"name":"Office 7_2","description":"","startip":"172.21.40.101","endip":"172.21.40.254"}]} | ||
− | You can also add using | + | You can also add using subnet mask or bit length: |
{"type":"addtrafficgroup","groups":[{"name":"Office 7_2","description":"","subnet":"172.21.40.0/24"}]} | {"type":"addtrafficgroup","groups":[{"name":"Office 7_2","description":"","subnet":"172.21.40.0/24"}]} | ||
{"type":"addtrafficgroup","groups":[{"name":"Office 7_2","description":"","subnet":"172.21.40.0/255.255.255.0"}]} | {"type":"addtrafficgroup","groups":[{"name":"Office 7_2","description":"","subnet":"172.21.40.0/255.255.255.0"}]} | ||
− | + | If a traffic group already exists, you can only add devices to it; you can't make any other changes. If you need to change a traffic group, remove and then re-add it with the correct settings. | |
To remove a traffic group, use the following request (which will delete the 2 listed groups) | To remove a traffic group, use the following request (which will delete the 2 listed groups) | ||
{"type":"removetrafficgroup","groups":["test1","test2"]} | {"type":"removetrafficgroup","groups":["test1","test2"]} | ||
− | + | Further examples: | |
curl -H "Content-Type: application/json" -X POST -d '{"type":"addtrafficgroup","groups":[{"name":"Office 7_2","description":"","startip":"172.21.40.101","endip":"172.21.40.254"}]}' "http://172.21.21.21:7902/rest/?userName=admin&userPass=admin" | curl -H "Content-Type: application/json" -X POST -d '{"type":"addtrafficgroup","groups":[{"name":"Office 7_2","description":"","startip":"172.21.40.101","endip":"172.21.40.254"}]}' "http://172.21.21.21:7902/rest/?userName=admin&userPass=admin" | ||
curl -H "Content-Type: application/json" -X POST -d '{"type":"addtrafficgroup","groups":[{"name":"Office 7_3","description":"","subnet":"172.21.41.101/255.255.255.0"}]}' "http://172.21.21.21:7902/rest/?userName=admin&userPass=admin" | curl -H "Content-Type: application/json" -X POST -d '{"type":"addtrafficgroup","groups":[{"name":"Office 7_3","description":"","subnet":"172.21.41.101/255.255.255.0"}]}' "http://172.21.21.21:7902/rest/?userName=admin&userPass=admin" | ||
Line 25: | Line 25: | ||
curl -H "Content-Type: application/json" -X POST -d '{"type":"removetrafficgroup","groups":["test1","test2"]}' "http://172.21.21.21:7902/rest/?userName=admin&userPass=admin" | curl -H "Content-Type: application/json" -X POST -d '{"type":"removetrafficgroup","groups":["test1","test2"]}' "http://172.21.21.21:7902/rest/?userName=admin&userPass=admin" | ||
− | Query traffic groups | + | Query traffic groups: |
curl -H "Content-Type: application/json" -X POST -d '{"type":"trafficgroupconfiguration"}' "http://172.21.21.21:7902/rest/?userName=admin&userPass=admin" | curl -H "Content-Type: application/json" -X POST -d '{"type":"trafficgroupconfiguration"}' "http://172.21.21.21:7902/rest/?userName=admin&userPass=admin" |
Revision as of 13:50, 24 April 2019
It is possible to provision and remove Traffic Groups from the GigaFlow server via the rest API using the following requests.
Add a new TrafficGroup called "Office_2" with no description, a starting IP of 172.21.40.101 and an ending IP of "172.21.40.254"; it will also set the group to only accept flows from the 3 listed devices:
{"type":"addtrafficgroup","groups":[{"name":"Office 7_2","description":"","startip":"172.21.40.101","endip":"172.21.40.254","natted":false,"devices":["172.21.40.254","83.70.199.180","172.21.40.199"]}]}
If you do not want to assign any devices, you can skip that parameter completely:
{"type":"addtrafficgroup","groups":[{"name":"Office 7_2","description":"","startip":"172.21.40.101","endip":"172.21.40.254"}]}
You can also add using subnet mask or bit length:
{"type":"addtrafficgroup","groups":[{"name":"Office 7_2","description":"","subnet":"172.21.40.0/24"}]} {"type":"addtrafficgroup","groups":[{"name":"Office 7_2","description":"","subnet":"172.21.40.0/255.255.255.0"}]}
If a traffic group already exists, you can only add devices to it; you can't make any other changes. If you need to change a traffic group, remove and then re-add it with the correct settings.
To remove a traffic group, use the following request (which will delete the 2 listed groups)
{"type":"removetrafficgroup","groups":["test1","test2"]}
Further examples:
curl -H "Content-Type: application/json" -X POST -d '{"type":"addtrafficgroup","groups":[{"name":"Office 7_2","description":"","startip":"172.21.40.101","endip":"172.21.40.254"}]}' "http://172.21.21.21:7902/rest/?userName=admin&userPass=admin" curl -H "Content-Type: application/json" -X POST -d '{"type":"addtrafficgroup","groups":[{"name":"Office 7_3","description":"","subnet":"172.21.41.101/255.255.255.0"}]}' "http://172.21.21.21:7902/rest/?userName=admin&userPass=admin" curl -H "Content-Type: application/json" -X POST -d '{"type":"addtrafficgroup","groups":[{"name":"Office 7_4","description":"","subnet":"172.21.41.101/24"}]}' "http://172.21.21.21:7902/rest/?userName=admin&userPass=admin" curl -H "Content-Type: application/json" -X POST -d '{"type":"addtrafficgroup","groups":[{"name":"test1","description":"","startip":"1.1.1.1","endip":"1.1.1.2","devices":["1.1.1.254","1.1.1.253"]},{"name":"test2","description":"test2 desc","startip":"1.1.1.4","endip":"1.1.1.5"}]}' "http://172.21.21.21:7902/rest/?userName=admin&userPass=admin" curl -H "Content-Type: application/json" -X POST -d '{"type":"removetrafficgroup","groups":["test1"]}' "http://172.21.21.21:7902/rest/?userName=admin&userPass=admin" curl -H "Content-Type: application/json" -X POST -d '{"type":"removetrafficgroup","groups":["test1","test2"]}' "http://172.21.21.21:7902/rest/?userName=admin&userPass=admin"
Query traffic groups:
curl -H "Content-Type: application/json" -X POST -d '{"type":"trafficgroupconfiguration"}' "http://172.21.21.21:7902/rest/?userName=admin&userPass=admin"