4.1. API Quickstart

4.1.1. Quick Get Assets Example

Here’s a simple example to get all device assets matching a query of:

  • assets that have NOT been seen in the last 3 days

  • assets seen by AWS

  • assets with an OS Type of Windows

Include extra fields in addition to the default fields specified in the API:

  • AWS: AWS Device Type

  • OS: Type

  • OS: Full OS String

>>> entries = [
...   {'type': 'simple', 'value': '! last_seen last_days 3'},
...   {'type': 'simple', 'value': 'os.type equals windows'},
...   {'type': 'simple', 'value': 'aws:id exists'},
... ]
>>> fields = ["aws:aws_device_type", "os.type", "os.os_str"]
>>> assets = devices.get(wiz_entries=entries, fields=fields, field_null=True)
>>> print(devices.LAST_GET['filter'])
not (specific_data.data.last_seen >= date("NOW - 3d")) and (specific_data.data.os.type == "Windows") and ((adapters_data.aws_adapter.id == ({"$exists":true,"$ne":""})))
>>> len(assets)
5
>>> j(list(assets[0]))
[
  "adapter_list_length",
  "adapters",
  "adapters_data.aws_adapter.aws_device_type",
  "internal_axon_id",
  "labels",
  "specific_data.data.hostname",
  "specific_data.data.name",
  "specific_data.data.network_interfaces.ips",
  "specific_data.data.network_interfaces.mac",
  "specific_data.data.os.os_str",
  "specific_data.data.os.type",
  "specific_data.data.last_seen"
]

4.1.2. More examples

Note

Look in the axonius_api_client.examples directory for proof of concept example scripts