You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 5 Next »

 

(also compare README.md in main directory of FOD/flowspy)

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 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/Editing existing rule (with name=Example5, it seems that id value in url can be arbitrary, but at least one attr value has to be different to before, especially for creating)
> 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/1/"

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



Deleting (id field in URL seems to be important here) (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/"

  • No labels