Widget

Methods described in this section relate to the widget API. These methods can be accessed at TenableAD.widgets.

class WidgetsAPI(api: restfly.session.APISession)[source]
create(dashboard_id: int, pos_x: int, pos_y: int, width: int, height: int, title: str) List[Dict][source]

Creates a new widget.

Parameters
  • dashboard_id (int) – The dashboard instance identifier.

  • pos_x (int) – x-axis position for widget.

  • pos_y (int) – y-axis position for widget.

  • width (int) – width of widget.

  • height (int) – height of widget.

  • title (str) – title for widget.

Returns

The created widget object.

Return type

list[dict]

Examples

>>> tad.widgets.create(
...     dashboard_id=1,
...     pos_x=1,
...     pos_y=1,
...     width=2,
...     height=2,
...     title='ExampleWidget',
...     )
define_widget_options(dashboard_id: int, widget_id: int, chart_type: str, series: List[Dict]) None[source]

Defines the widget option.

Parameters
  • dashboard_id (int) – The dashboard instance identifier.

  • widget_id (int) – The dashboard instance identifier.

  • chart_type (str) –

    The type of chart for widget. possible options

    are BigNumber, LineChart, BarChart, SecurityCompliance and StepChart.

  • series (list) – Additional keywords passed will be added to the series list of dicts within the API call.

Return type

None

Examples

>>> tad.widgets.define_widget_options(
...     dashboard_id=1,
...     widget_id=1,
...     chart_type='BigNumber'
...     series=[
...     {
...         'dataOptions': {
...             'type': 'User',
...             'duration': 1,
...             'directoryIds': [1, 2, 3],
...             'active': True
...         },
...         'displayOptions': {
...             'label': 'label'
...         }
...     }
...     ]
...     )
delete(dashboard_id: int, widget_id: int) None[source]

Deletes an existing widget.

Parameters
  • dashboard_id (int) – The dashboard instance identifier.

  • widget_id (int) – The widget instance identifier.

Return type

None

Examples

>>> tad.widgets.delete(
...     dashboard_id=1,
...     widget_id=1
...     )
details(dashboard_id: int, widget_id: int) Dict[source]

Retrieves the details for a specific widget.

Parameters
  • dashboard_id (int) – The dashboard instance identifier.

  • widget_id (int) – The widget instance identifier

Returns

The widget object.

Return type

dict

Examples

>>> tad.widget.details(dashboard_id=1, widget_id=1)
list(dashboard_id: int) List[Dict][source]

Retrieves all the widgets.

Parameters

dashboard_id (int) – The dashboard instance identifier.

Returns

The list of widget objects.

Return type

list

Examples

>>> tad.widgets.list(dashboard_id=13)
update(dashboard_id: int, widget_id: int, **kwargs) Dict[source]

Updates an existing widget.

Parameters
  • dashboard_id (int) – The dashboard instance identifier.

  • widget_id (int) – The dashboard instance identifier.

  • pos_x (optional, int) – x-axis position for widget.

  • pos_y (optional, int) – y-axis position for widget.

  • width (optional, int) – width of widget.

  • height (optional, int) – height of widget.

  • title (optional, str) – title for widget.

Returns

The updated widget object.

Return type

dict

Examples

>>> tad.widgets.update(
...     dashboard_id=1,
...     widget_id=1,
...     pos_x=1,
...     pos_y=1,
...     width=3,
...     height=3,
...     title='EditedWidget'
...     )
widget_options_details(dashboard_id: int, widget_id: int) Dict[source]

Gets the details of widget options.

Parameters
  • dashboard_id (int) – The dashboard instance identifier.

  • widget_id (int) – The dashboard instance identifier.

Returns

The widget option object.

Return type

dict

Examples

>>> tad.widgets.widget_options_details(
...     widget_id=1,
...     dashboard_id=1
...     )