Settings
e.g. $SERVER_ADDR="127.1:8082"
e.g. $TOKEN="..." # REST API token in FoD (of user)
e.g. $id="12" # rule id in FoD
Querying
Querying of all rules (of user)
> curl -vvvv -X GET "http://$SERVER_ADDR/api/routes/" -H "Authorization: Token $TOKEN"
Querying of single rule
> curl -vvvv -X GET "http://$SERVER_ADDR/api/routes/$id/" -H "Authorization: Token $TOKEN"
Querying thenactions
> curl -vvvv -X GET "http://$SERVER_ADDR/api/thenactions/" -H "Authorization: Token $TOKEN"
Creating new rule
> curl -X POST -F "name=Example5" -F "comments=Description" -F "status=INACTIVE" -F "source=0.0.0.0/0" -F "sourceport=30" -F "destination=10.0.0.56" F destinationport="1020,80-90,101" -F "then=https://fod.example.com/api/thenactions/3/" -H "Authorization: Token $TOKEN" "http://$SERVER_ADDR/api/routes/"
The normal attribute specification for "name", "source", "destination", and "then" are required; Currently the combination of source and destinantion of a new rule to be created has to different to any combination of source and destination of any existsing rule; after it has been created, each rule can be changed without this restriction; status can be "INACTIVE" or "ACTIVE"
Changing existing rule
curl -X PUT -F "name=Example5" -F "comments=Description" -F "status=INACTIVE" -F "source=0.0.0.0/0" -F "sourceport=30" -F "destination=10.0.0.56" F destinationport="1020,80-90,101" -F "then=https://fod.example.com/api/thenactions/3/" -H "Authorization: Token $TOKEN" "http://$SERVER_ADDR/api/routes/$id/"
Attribute value for name has to be specified again, but can be different than before; Also, similarly as on creation source and destination are required, but can now have arbitrary values independet of other existsing rules;
Deleting (does not work as rule is automatically recreated in FOD after some seconds; in new version does not work at all any more)
> curl -X DELETE -H "Authorization: Token $TOKEN" "http://$SERVER_ADDR/api/routes/$id/"
(also compare original REST API documentation in README.md in main directory of FOD/flowspy (https://github.com/grnet/flowspy/blob/master/README.md))