List dashboards

Updated at:

Call the ListDashboard operation to query dashboards in a specified project.

Prerequisites

Before you begin, make sure that you have completed the following steps:

Parameters

def list_dashboard(self, project, offset=0, size=100):

Request parameters

Parameter

Type

Required

Description

Example

project

str

Yes

The name of the project.

ali-test-project

offset

int

No

The starting position for the query. Default value: 0.

0

size

int

No

The number of entries to return on each page. Default value: 100. Maximum value: 500.

100

Response parameters

For more information about the response parameters, see ListDashboard.

Sample code

from aliyun.log import LogClient
import os


def main():
    # This example retrieves the AccessKey ID and AccessKey Secret from environment variables.
    accessKeyId = os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_ID', '')
    accessKey = os.environ.get('ALIBABA_CLOUD_ACCESS_KEY_SECRET', '')

    # The Log Service endpoint.
    endpoint = "cn-hangzhou.log.aliyuncs.com"

    project = 'ali-test-project'

    client = LogClient(endpoint, accessKeyId, accessKey, "")

    res = client.list_dashboard(project)
    res.log_print()


if __name__ == '__main__':
    main()

Sample response

ListResponse for dashboards:
headers: {'Server': 'AliyunSLS', 'Content-Type': 'application/json', 'Content-Length': '1084', 'Connection': 'keep-alive', 'Access-Control-Allow-Origin': '*', 'Date': 'Mon, 28 Oct 2024 08:03:23 GMT', 'x-log-time': '1730102603', 'x-log-requestid': '671F454B1FE738296E13EFA8'}
count: 5
total: 5
dashboards ['dashboard-1727682337978-128169', 'dashboard-1728382185158-140551', 'dashboard-1728452197690-149668', 'internal-alert-analysis', 'internal-alert-analysis-en']

Process finished with exit code 0

References