Skip to content

Add meta data parameter to get_devices. #26

@iunderwood

Description

@iunderwood

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions