akshaymane920 / pyFortimanagerAPI

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

policy package status in Installation targets #11

Closed bartdorlandt closed 2 years ago

bartdorlandt commented 2 years ago

Hi,

I've been working on some automation on the fortimanager as well, though I'm struggling to read the "Policy Package Status" from the installation targets view using the API.

Have you had any luck finding where this could be retrieved?

Thanks in advance. Cheers, Bart

ralle12345 commented 2 years ago

Hi @bartdorlandt I took a look at the API docs, but couldn't find any API call for that either. Best, Ralph

bartdorlandt commented 2 years ago

There is a hidden/undocumented option. I don't have access to it atm.

Along the lines of /firewall/_pkg/status.

Please have a try with that. I'll be back in 3 weeks...

ralle12345 commented 2 years ago

Yes, you are right. The correct payload is

{
    "method": "get",
    "params": [{
        "url": "/pm/config/adom/root/_package/status"
    }],
    "id": 1,
    "verbose": 1,
    "session": "<redacted>"
} 

With the url being one of

And by the way I thought you were looking for the corect API call to accomplish the above :)

akshaymane920 commented 2 years ago

Hello Team, I found something Url = /gui/adoms/adomname/devices/assignedpkgs Method=get

The output results in all the packages assigned to the respective devices and their status.

Regards Akshay Mane

On Mon, 11 Jul, 2022, 7:56 pm ralle12345, @.***> wrote:

Yes, you are right. The correct payload is

{

"method": "get",

"params": [{

    "url": "/pm/config/adom/root/_package/status"

}],

"id": 1,

"verbose": 1,

"session": "<redacted>"

}

With the url being one of

  • pm/config/adom//_package/status (all Policy Packages)
  • pm/config/adom//pkg//_package/status (specific Policy Package)
  • pm/config/adom//_package/status/<device>/ (specifig device/vdom)

— Reply to this email directly, view it on GitHub https://github.com/akshaymane920/pyFortimanagerAPI/issues/11#issuecomment-1180479075, or unsubscribe https://github.com/notifications/unsubscribe-auth/AS3NL3S3XJRRHDR7LUSVECDVTQVI3ANCNFSM52FAFKXA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

bartdorlandt commented 2 years ago

@ralle12345 , back from vacation and wrote it in a tweet :) https://twitter.com/BartOmation/status/1554028688194379776

The URL I used is: "/pm/config/adom/{ADOM}/_package/status/{fgt_name}/{vdom}".

this will give back 4 keys: dev, pkg, status, vdom.

the status options are ["imported", "installed", "never installed", "modified", "out-of-sync", "conflict", "unknown"]