pyFortimanagerAPI
pyFortimanagerAPI copied to clipboard
Is it possible to Add FortiAP/FortiSwitch Device Model with this?
As per title, I'm wondering if it's possible to API call adding a FortiAP or FortiSW? Cheers.
Hey @Nugeorge, Thanks for commenting. I haven't worked on FortiAP or FortiSwitch yet for the project. I will tag it as an Enhancement task But we can try using "custom_api_call" method, if you know the api call. If it is successful, you can create a method out of it. I shall work on it as well.
Hello, I managed to get the AP's and switches devices.
def get_fortiSwitch(self):
session = self.login()
payload = {
"method":"get","params":[
{
"url":f"pm/config/adom/{self.adom}/obj/fsp/managed-switch",
"scope member":[{"name":"All_FortiGate"}]
}
]
}
payload.update({"session": self.sessionid})
get_devices = session.post(
url=self.base_url, json=payload, verify=False)
return get_devices.json()
def get_fortiAp(self):
session = self.login()
payload = {
"method":"get","params":[
{
"url":f"pm/config/adom/{self.adom}/obj/wireless-controller/wtp",
"scope member":[{"name":"All_FortiGate"}],
"expand datasrc":[{"name":"wtp-profile",
"datasrc":[{"obj type":"wireless-controller wtp-profile",
"sub fetch":{"platform":{"subfetch hidden":1},
"lan":{"subfetch hidden":1},
"lbs":{"subfetch hidden":1},
"radio-1":{},
"radio-2":{},
"radio-3":{}},
"subfetch filter":1}]}],"data":None
}
]
}
payload.update({"session": self.sessionid})
get_devices = session.post(
url=self.base_url, json=payload, verify=False)
return get_devices.json()