3.2.6. devices/users get-by-saved-query¶
This command will get assets returned from a saved query for users or devices.
3.2.6.1. Common Options¶
Connection Options for examples of supplying the Axonius credentials and URL.
Export Options for examples of exporting data in different formats and outputs.
Selecting Fields Examples for examples of selecting which fields (columns) to include in the response. The fields you supply for get-by-saved-query will be appended to the fields specified inside of the saved query. (added in 2.1.4)
3.2.6.2. Examples¶
3.2.6.3. Help Page¶
3.2.6.3.1. axonshell devices/users get-by-saved-query¶
Get assets using a saved query.
axonshell devices/users get-by-saved-query [OPTIONS]
Options
- -u, --url <URL>¶
Required URL of an Axonius instance
- -k, --key <KEY>¶
Required API Key (or username if credentials=True) of user in an Axonius instance
- -s, --secret <SECRET>¶
Required API Secret (or password if credentials=True) of user in an Axonius instance
- --max-rows <max_rows>¶
Stop fetching assets after this many rows have been received
- --max-pages <max_pages>¶
Stop fetching assets after this many pages have been received
- --page-size <page_size>¶
Number of assets to fetch per page
- Default
2000
- --page-sleep <page_sleep>¶
Seconds to wait in between each fetch of a page
- Default
0
- -xf, --export-file <PATH>¶
File to save data to (supports templating: {DATE}, {HISTORY_DATE})
- Default
- -xp, --export-path <export_path>¶
If –export-file supplied, the directory to write –export_file to (supports templating: {DATE}, {HISTORY_DATE})
- Default
/home/docs/checkouts/readthedocs.org/user_builds/axonius-api-client/checkouts/stable/docs
- -xo, --export-overwrite, -nxo, --no-export-overwrite¶
If –export-file supplied and it exists, overwrite it
- Default
False
- -xb, --export-backup, -nxb, --no-export-backup¶
If –export-file supplied and it exists, rename it with datetime
- Default
False
- --echo, --no-echo¶
Print out details during fetch
- Default
True
- --page-progress <page_progress>¶
Print progress every N rows
- Default
10000
- -xt, --export-format <export>¶
Formatter to use when exporting asset data
- Default
json
- Options
json_to_csv | json | table | xml | xlsx | csv
- -tf, --table-format <table_format>¶
Base format to use for –export-format=table
- Default
fancy_grid
- Options
asciidoc | double_grid | double_outline | fancy_grid | fancy_outline | github | grid | heavy_grid | heavy_outline | html | jira | latex | latex_booktabs | latex_longtable | latex_raw | mediawiki | mixed_grid | mixed_outline | moinmoin | orgtbl | outline | pipe | plain | presto | pretty | psql | rounded_grid | rounded_outline | rst | simple | simple_grid | simple_outline | textile | tsv | unsafehtml | youtrack
- --table-max-rows <table_max_rows>¶
Only return this many rows for –export-format=table
- Default
5
- --table-api-fields, --no-table-api-fields¶
Include API related fields in table output
- Default
False
- --schema, --no-schema¶
Add schema information to the export
- Default
False
- --json-flat, --no-json-flat¶
Flat JSON output (one line per row)
- Default
False
- --titles, --no-titles¶
Rename fields from internal field names to their column titles
- Default
False
- --field-compress, --no-field-compress¶
Compress field names
- Default
False
- --field-replace <field_replace>¶
Replace characters in field names ex: ‘text=replace’ (multiples)
- Default
- --join, --no-join¶
Join multivalue fields using –join-value
- Default
False
- --join-value <field_join_value>¶
Value to use for joining multivalue fields, default: n
- Default
- --join-trim <field_join_trim>¶
Character length to trim joined multivalue fields
- Default
32000
- -exf, --explode <FIELD>¶
Flatten and explode a fields values into multiple rows
- -exe, --explode_entities, --explode-entities, -nexe, --no-explode_entities, --no-explode-entities¶
Split rows into one row for each asset entity (will enable include-details)
- Default
False
- --flatten, --no-flatten¶
Remove complex fields and re-add their sub-field values to the row
- Default
False
- -fx, --field-exclude <FIELD>¶
Fields to exclude from each row (multiples)
- Default
- --field-null, --no-field-null¶
Add missing fields with –field-null-value
- Default
False
- --field-null-value <field_null_value>¶
Value to use for fields that are not returned
- --adapters-missing, --no-adapters-missing¶
Add a column showing adapters missing from each asset
- Default
False
- --include-dates, --no-include-dates¶
Include history date and current date as columns in each asset
- Default
False
- --software-whitelist-file <whitelist>¶
Read in a file of software names to add missing and delta sw columns
- --tag <TAG>¶
Tags to add to each asset (multiples)
- Default
- --tag-invert, --no-tag-invert¶
Only add tags to assets that do NOT match the query provided
- Default
False
- --untag <TAG>¶
Tags to remove from each asset (multiples)
- Default
- --untag-invert, --no-untag-invert¶
Only remove tags from assets that do NOT match the query provided
- Default
False
- -id, --include-details, -nid, --no-include-details¶
Include details for aggregated fields
- Default
False
- -sd, --sort-descending, -nsd, --no-sort-descending¶
Sort –sort-field descending
- Default
False
- -sf, --sort-field <sort_field>¶
Sort assets based on a specific field
- --csv-field-flatten, --no-csv-field-flatten¶
For CSV/XLSX Export: Enable flattening of complex fields
- Default
True
- --csv-field-join, --no-csv-field-join¶
For CSV/XLSX Export: Enable joining of list fields
- Default
True
- --csv-field-null, --no-csv-field-null¶
For CSV/XLSX Export: Enable null values for missing fields
- Default
True
- -anfne, --api-null-for-non-exist, -nanfne, --no-api-null-for-non-exist¶
Ask the REST API to return null for non existent fields
- Default
False
- -afonef, --api-filter-out-non-existing-fields, -nafonef, --no-api-filter-out-non-existing-fields¶
Ask the REST API to filter out non existent fields
- Default
True
- -amfi, --api-max-field-items <max_field_items>¶
Ask the REST API to limit the number of values returned for a field
- -amcfi, --api-complex-fields-preview-limit <complex_fields_preview_limit>¶
Ask the REST API to limit the number of values returned for a complex field
- -ahfc, --api-use-heavy-fields-collection, -nahfc, --no-api-use-heavy-fields-collection¶
Ask the REST API to use the heavy fields collection
- Default
False
- -f, --field <ADAPTER:FIELD>¶
Fields to include in the format of adapter:field (multiples)
- -fr, --field-regex <ADAPTER_REGEX:FIELD_REGEX>¶
Regular expressions of fields to include (multiples)
- -frro, --fields-regex-root-only, -nfrro, --no-fields-regex-root-only¶
Only include root fields for –field-regex
- Default
True
- -ff, --field-fuzzy <ADAPTER:FIELD>¶
Fuzzy matching of fields to include (multiples)
- -fro, --fields-root <ADAPTER>¶
Select all root fields for a given adapter (PERFORMANCE HIT!)
- -fer, --fields-error, -nfer, --no-fields-error¶
Throw errors for invalid fields supplied in –field
- Default
True
- -hd, --history-date <YYYY-MM-DD>¶
Return results for a given date in history
- -hda, --history-days-ago <history_days_ago>¶
Return results for a history snapshot N days ago
- -hex, --history-exact, -nhex, --no-history-exact¶
Date supplied in history-date or history-days-ago is an exact date
- Default
False
- -if, --include-fields, -nif, --no-include-fields¶
Include fields from the saved query GUI Path: Assets Table => Columns, REST API Saved Query path: view => query => fields, REST API get assets argument: fields, API Client get assets argument: fields: Optional[list[str]] = None, axonshell get assets argument: –fields/-f
- Default
True
- -iea, --include-excluded-adapters, -niea, --no-include-excluded-adapters¶
Include column filters for excluded adapters from the saved query GUI Path: Assets Table => Columns => Column Filters => Field values - refine by adapter connection, REST API Saved Query path: view => colExcludeAdapters, REST API get assets argument: excluded_adapters, API Client get assets argument: excluded_adapters: Optional[list[dict]] = None, axonshell get assets argument: NOT IMPLEMENTED (but is used in get-by-saved-query)
- Default
True
- -iaea, --include-asset-excluded-adapters, -niaea, --no-include-asset-excluded-adapters¶
Include column filters for asset excluded adapters fields from the saved query GUI Path: Assets Table => Columns => Column Filters => Field values - refine by adapter connection, REST API Saved Query path: view => colExcludeAdapters, REST API get assets argument: excluded_adapters, API Client get assets argument: excluded_adapters: Optional[list[dict]] = None, axonshell get assets argument: NOT IMPLEMENTED (but is used in get-by-saved-query)
- Default
True
- -iff, --include-field-filters, -niff, --no-include-field-filters¶
Include column filters for field filters from the saved query GUI Path: Assets Table => Columns => Column Filters => Field values - refine by condition, REST API Saved Query path: view => colFilters, REST API get assets argument: field_filters, API Client get assets argument: field_filters: Optional[list[dict]] = None, axonshell get assets argument: NOT IMPLEMENTED (but is used in get-by-saved-query)
- Default
True
- -iaf, --include-asset-filters, -niaf, --no-include-asset-filters¶
Include column filters for asset filters from the saved query GUI Path: Assets Table => Columns => Column Filters => Asset entities - refine by condition, REST API Saved Query path: view => assetConditionExpressions, REST API get assets argument: asset_filters, API Client get assets argument: asset_filters: Optional[list[dict] = None, axonshell get assets argument: NOT IMPLEMENTED (but is used in get-by-saved-query)
- Default
True
- -uce, --use-cache-entry, -nuce, --no-use-cache-entry¶
Ask the API to use a cache entry for this query, if available
- Default
False
- -n, --name <name>¶
Required Name of saved query
- --help-detailed <help_detailed>¶
Show detailed help and exit
- Options
auth | assetexport | selectfields | asset_helper