Grafana api powershell

I use Grafana V8.5.13. I’m new in powershell and Grafana.

I want to export all dashboards with a powershell script. When i want to do a curl :

curl MyUrl/api/folders/
i have this message :


Thanks in advance.



Have you rewd the following documentation?


Yes, all HTTP API documentation.


on Chrome when i type MyUrl/api/folders, i have what i want :

[{“id”:24,“uid”:“vFCSdTNVk”,“title”:“Business”},{“id”:23,“uid”:“h9i97TH4k”,“title”:“ISO - Monitoring”},{“id”:20,“uid”:“9A6jMoNVz”,“title”:“ISO - Windows”},{“id”:1,“uid”:“po8qW8fMk”,“title”:“Monitoring - Alerts”},{“id”:8,“uid”:“pFfHMUBMz”,“title”:“Monitoring Infrastructure”}]

But to do it programatically it is abiy different you need to provide authorization bearer token

oh yes, here my powershell code :

$GrafanaURL = MyGrafanaURL/api/folders"

[String]$Key = MyKey
$Headers = @{ Authorization = “Bearer $($Key)”}
$folders = Invoke-RestMethod -Uri $GrafanaURL -Method Get -Headers $Headers -ContentType ‘application/json’;

Write-Host $folders

And the result is that $folders is empty.

You want dashboards right per original post?

"want to export all dashboards with a "

Yes the goal is to export all dashboards in json or csv format from all my folders.
I use this :

Thanks for your help.

1 Like

Check this out its with python but you can port the idea to powershell

Many thanks for your help :+1: :+1: :+1: :+1: :+1: :+1:

1 Like

what is the purpose of this effort? What are you trying to solve?

I started a new job and i’m new in powershell. The goal it’s to import all dashboards in TFS.


another option is to also backup the following folders