Learn how to configure Grafana® to use the API and how to make calls to the exposed API.
Requirements
- a Public Cloud project in your OVHcloud account
- access to the OVHcloud Control Panel
- a Grafana® database running on your OVHcloud Public Cloud project (see this guide)1
Instructions
Create a Grafana® service account
From the Grafana® user interface, select Home
, Administration
, and Service
Accounts.
Then, select Add Service Account
.
Create a new service account sa-editor
with the role Editor
.
Click Create
.
Click on Add service account token
:
Enter the name of the desired token, grafana-sa-token-editor
, and click on Generate token
:
Copy the generated token.
The created token appears in the tokens list:
Create a folder
Before using the Grafana® API, you must have at least one folder on your Dashboard. To create one, click Dashboard
in the left-hand navigation menu. Then click New
and select New Folder
.
Give your folder a name, then click Create
.
You are ready to use this token with the Grafana® API.
Use the Grafana® API
Authorized IP addresses
in the Grafana® configuration. See our Grafana® - Configure an 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" } ]
Go further
For more information and tutorials, please see our other Cloud Databases support guides or explore the guides for other OVHcloud products and services.
[1]: The Grafana Labs Marks are trademarks of Grafana Labs, and are used with Grafana Labs’ permission. We are not affiliated with, endorsed or sponsored by Grafana Labs or its affiliates.