For AI agents: the complete documentation index is available at https://docs.us.ovhcloud.com/en/llms.txt, the full documentation bundle is available at https://docs.us.ovhcloud.com/en/llms-full.txt, and this page is available as Markdown at https://docs.us.ovhcloud.com/en/public-cloud/data-analytics/dashboards-tutorial-use-grafana-api.md.
  • English

Dashboards - Tutorial: How to use the Grafana® API

View as Markdown

Learn how to configure Grafana® to use the API and how to make calls to the exposed API.

 

Requirements

 

Instructions

Create a Grafana® service account

From the Grafana® home screen, select Administration, Users and access, then Service Accounts.

Click Add Service Account.

Service accounts - Dashboards tutorial use Grafana API

Create a new service account sa-editor with the role Editor.

Click Create.

Create service account

Click on Add service account token:

Service acount details

Enter the name of the desired token, grafana-sa-token-editor, and click on Generate token:

Add token - Dashboards tutorial use Grafana API

Copy the generated token.

Warning

NOTE: After closing the pop-up, you will no longer be able to display the token!

Service token - Dashboards tutorial use Grafana API

The created token appears in the tokens list:

Service acount details token

 

Create a folder

Before using the Grafana® API, you must have at least one folder on your Dashboard. To create one, click Dashboards in the left-hand navigation menu. Then click New and select New folder.

New - Dashboards tutorial use Grafana API

Give your folder a name, then click Create.

New folder - Dashboards tutorial use Grafana API

You are ready to use this token with the Grafana® API.

 

Use the Grafana® API

Info

Detailed instructions on how to use the API and the possible actions can be found in the official documentation.

Warning

NOTE: Don't forget to set the Authorized IP addresses in the Grafana® configuration. See our Configure your Dashboards instance to accept incoming connections guide for more details.

To send a request to the API, you must use the previously created token and set it in the request header as a "Bearer token":

export GRAFANA_API_TOKEN=042footoken420

curl -H "Authorization: Bearer $GRAFANA_API_TOKEN" https://grafana-xxxxxxxxx-yyyyyyyyy.database.cloud.ovh.us/api/folders    
[
    {
        "id":11,
        "uid":"HnDCAp-4k",
        "title":"foo 1"
    },
    {
        "id":5,
        "uid":"cb_S6Pb4k",
        "title":"foo 2"
    },
    {
        "id":9,
        "uid":"Xav55taVk",
        "title":"foo 3"
    },
    {
        "id":10,
        "uid":"AH8sApaVz",
        "title":"foo 4"
    }
]
Tip

Congratulations! You can now use all the power of the Grafana® API.

 

Go further

Browse all the Analytics guides.

Browse the rest of the OVHcloud US documentation for guides on our other products and services.

Learn more about Cloud Analytics on the OVHcloud US website.

OVHcloud Managed Databases and Analytics:

  • Grafana® is a registered trademark of Grafana Labs and is used with the permission of Grafana Labs. OVH SAS and its subsidiaries are not affiliated with or endorsed by Grafana Labs.
  • Kafka® is a registered trademark of The Apache Software Foundation and has been licensed for use by OVHcloud, who has no affiliation with and is not endorsed by The Apache Software Foundation.
  • MongoDB® is a registered trademark of MongoDB, Inc.
  • MySQL® is a registered trademark of Oracle and/or its affiliates.
  • PostgreSQL® is a registered trademark of the PostgreSQL Community Association of Canada.