Hi,
I am working on automating Grafana resources provisioning through the API, that is folders, dashboards, datasources and notifiers. The idea is to keep everything under source control and implement processes that query Grafana’s API to update/create what’s needed when there are changes.
I hit a wall with the way the relation between dashboard and folder is handled. Here’s a scenario that explains the issue:
We have a folder called infrastructure that will contain infra related dashboards. The process will create the folder by querying the API and sending the following json:
{
“uid”: “ebCPnfmGk”,
“title”: “Infrastructure”,
“url”: “/dashboards/f/ebCPnfmGk/infrastructure”,
“hasAcl”: false,
“canSave”: true,
“canEdit”: true,
“canAdmin”: true
}
To create the dashboards under this folder, I have to set folderId in the dashboards json. The problem is I don’t know what’s the folderid until the folder is created. And I can’t find another way to link dashboards to folders by the other identifiers that I can hard code like uid and title.
I tried hardcoding an id for the folder resource but it seems to be ignored by the API and a new id is generated
Any suggestions to overcome this?
Thank you.