DavidChayla / FortigateApi

Access Fortigate REST API in python
GNU General Public License v3.0
83 stars 34 forks source link

Feature Request - Policy Route #1

Open daBONDi opened 7 years ago

daBONDi commented 7 years ago

You got the Fortigate Rest API Docs? where i can find it?

I tryed to add the functions for policy route entrys and copy paste from you the static route functions. i can read and Delete the Policy route with you self.ApiXXX functions, but on add i got a problem

should the payload be equal to thhe console commands? maybe you can give me some hint, or implement it in your Awesome lib

Thanx in advance

DavidChayla commented 7 years ago

hi sorry i'm pretty late, i've just seen your comment could you show me the code you've written for the policy route, we will start from here thks

daBONDi commented 7 years ago

Hi David, the problem was missing fields in the json post, thats because i got no documentation, and still as fortigate customerer i need to pay a huge amount of money to get the fucking docs for it, realy sucks.

Here the json snipp i post to the api to get it to work, maybe you can build it into your api some time

    addResult = fgt.post('/api/v2/cmdb/router/policy', params={"vdom": vdom},
             data={"json": {
                 "input-device": [ { "name": "lan"} ],
                 "src":  [{"subnet": "192.168.10.5/255.255.255.255",
                           "q_origin_key": "192.168.10.5/255.255.255.255"}],
                 "dst": [{"subnet": "0.0.0.0/0.0.0.0",
                          "q_origin_key": "0.0.0.0/0.0.0.0"}],
                 "output-device": "wan2",
                 "comments": "something",
             }})