Skip to content

Table of Contents

reporting

Reporting Objects

class Reporting()

The class includes all necessary methods to access the Grafana reporting API endpoints. Be aware that the functionality is a Grafana ENTERPRISE v7.0+ feature

HINT: Note Grafana Enterprise API need required permissions if fine-grained access control is enabled

Arguments:

  • grafana_api_model APIModel - Inject a Grafana API model object that includes all necessary values and information

Attributes:

  • grafana_api_model APIModel - This is where we store the grafana_api_model

get_reports

def get_reports() -> list

The method includes a functionality to get all reports

Required Permissions: Action: reports:read Scope: [reports:, reports:id:]

Raises:

  • Exception - Unspecified error by executing the API call

Returns:

  • api_call list - Returns all reports

get_report_by_id

def get_report_by_id(id: int) -> dict

The method includes a functionality to get a report specified by the report id

Arguments:

  • id int - Specify the report id

Required Permissions: - Action - reports:read - Scope - [reports:, reports:id:, reports:id:]

Raises:

  • ValueError - Missed specifying a necessary value
  • Exception - Unspecified error by executing the API call

Returns:

  • api_call dict - Returns the report

create_report

def create_report(report: Report) -> int

The method includes a functionality to create a report

Arguments:

  • report Report - Specify the report object

Required Permissions: - Action - reports:create - Scope - N/A

Raises:

  • ValueError - Missed specifying a necessary value
  • Exception - Unspecified error by executing the API call

Returns:

  • api_call int - Returns the report id

update_report

def update_report(id: int, report: Report)

The method includes a functionality to update a report

Arguments:

  • id int - Specify the report id
  • report Report - Specify the report object

Required Permissions: - Action - reports:write - Scope - [reports:, reports:id:, reports:id:]

Raises:

  • ValueError - Missed specifying a necessary value
  • Exception - Unspecified error by executing the API call

Returns:

None

delete_report

def delete_report(id: int)

The method includes a functionality to delete a report specified by the report id

Arguments:

  • id int - Specify the report id

Required Permissions: - Action - reports:delete - Scope - [reports:, reports:id:, reports:id:]

Raises:

  • ValueError - Missed specifying a necessary value
  • Exception - Unspecified error by executing the API call

Returns:

None

send_report

def send_report(id: int,
                emails: str = None,
                use_emails_from_report: bool = None)

The method includes a functionality to send a report to a specified email addresses

Arguments:

  • id int - Specify the id of forwarded report. It is the same as in the URL when editing a report, not to be confused with the id of the dashboard.
  • emails str - Specify the comma-separated list of emails to which to send the report to. Overrides the emails from the report. Required if useEmailsFromReport is not present (default None)
  • use_emails_from_report bool - Specify if the emails inside the report should be used. Required if emails is not present (default None)

Required Permissions: - Action - reports:send - Scope - N/A

Raises:

  • ValueError - Missed specifying a necessary value
  • Exception - Unspecified error by executing the API call

Returns:

None

get_report_branding_settings

def get_report_branding_settings() -> dict

The method includes a functionality to get the report branding settings

Required Permissions: Action: reports.settings:read Scope: N/A

Raises:

  • Exception - Unspecified error by executing the API call

Returns:

  • api_call dict - Returns the report branding settings

save_report_branding_settings

def save_report_branding_settings(branding_settings: ReportBrandingSettings)

The method includes a functionality to save the report branding settings

Arguments:

  • branding_settings ReportBrandingSettings - Specify the report branding settings object.

Required Permissions: - Action - reports.settings:write - Scope - N/A

Raises:

  • ValueError - Missed specifying a necessary value
  • Exception - Unspecified error by executing the API call

Returns:

None

send_report_test_email

def send_report_test_email(report: Report)

The method includes a functionality to send a test report email

Arguments:

  • report Report - Specify the report object

Required Permissions: - Action - reports: send - Scope - N/A

Raises:

  • ValueError - Missed specifying a necessary value
  • Exception - Unspecified error by executing the API call

Returns:

None