akshaymane920 / pyFortimanagerAPI

A wrapper for FortiManager API
https://akshaymane920.github.io/pyFortimanagerAPI/
MIT License
32 stars 34 forks source link

Virtual IP Name update not visable in GUI #12

Closed JuM1697 closed 2 years ago

JuM1697 commented 2 years ago

Hi there, this "issue" is not at all related to your package, but I thought I'd get better and more precise feedback here instead from the Fortinet customer support. If this kind of questions are not wanted here, feel free to close/delete it.

At the moment Im trying to update the name of VirtualIP Objects in an ADOM using the API and having my FMG running on version 7.2.0. With the following request it seems to work:

{ 
        "id": 1,
        "method": "set",  
        "params": [. 
            {  
                "data": {  
                    "name": "Demo-Host04",  
                    "comment": "Test"  
                },  
                "url": "/pm/config/adom/Demo-ADOM/obj/firewall/vip/Demo-Host07"  
            }  
        ],  
        "session": SESSIONTOKEN  
}  

Because I receive a "200 OK" Status return, and if I do a

{
        "id": 1,
        "method": "get",
        "params": [
            {
                "url": "/pm/config/adom/Demo-ADOM/obj/firewall/vip/Demo-Host07"
            }
        ],
        "session": SESSIONTOKEN
}

I get a "Object not Found Error", while a

{
        "id": 1,
        "method": "get",
        "params": [
            {
                "url": "/pm/config/adom/Demo-ADOM/obj/firewall/vip/Demo-Host04"
            }
        ],
        "session": SESSIONTOKEN
}

Shows the desired output.

However, in the GUI I can't see that name Change, nor the set comment. And If I edit the VIP on the GUI (like setting a comment there) I'm no longer able to access it from the API with the "new" Name, but I'm able to find it again with the old name. Is that a known behavior? Did I miss something while updating the object? Unfortunately the documentation is a bit... thin in my opinion.

Anyway, I hope you guys know how to help, I'd really appreciate some feedback. Cheers!

JuM1697 commented 2 years ago

Hi Everybody,

I found the solution for that issue.
I was missing the "commit" command.
Without that no changes were saved to the ADOM.
Find an example here:

{

  "method": "exec",

  "params": [

    {

      "url": "/dvmdb/adom/{adom_name}/workspace/commit"

    }

  ],

  "session": "{{sessionID}}",

  "id": 1

}