pyFortimanagerAPI
pyFortimanagerAPI copied to clipboard
Add meta data parameter to get_devices.
This is to add a toggle to return all the metadata fields with a device when getting the devices.
def get_devices(self, metadata=False):
"""
:return: returns list of devices added in FortiManager
"""
session = self.login()
payload = \
{
"method": "get",
"params":
[
{
"url": f"/dvmdb/adom/{self.adom}/device/"
}
]
}
if metadata is True:
payload['params'][0].update({"meta fields": ["*"]})
payload.update({"session": self.sessionid})
get_devices = session.post(
url=self.base_url, json=payload, verify=False)
return get_devices.json()
According to the FNDN, metadata is not returned by default.