Looking for a curl example to retrieve folders and dashboards using the Folder/Dashboard Search API

Hello All,
I like to ask if a curl expert could provide a basic example on how to retrieve folders and dashboards using “Folder/Dashboard Search API”. I have tried many variations of curl syntax with no luck, any examples would be greatly appreciated.

Thank you in advance!

Can you give an example of what doesn’t work for you?

Here’s a cURL command that works for getting the home dashboard, when running Grafana locally with default admin credentials:

curl http://admin:admin@localhost:3000/api/dashboards/home

The most basic example (for a dashboard for which there is no authentication required) is just to do:

curl 'https://play.grafana.org/api/search' 

It’ll cap you at a thousand dashboards, but other than that the result is a list of dashboards with their associated folders.

If you need authentication as well I’d recommend creating API keys from Configuration > API keys

curl -H "Authorization: Bearer <paste key here>" https://play.grafana.com/api/search

but you can also either use basic auth (like in Arve’s comment :point_up_2:) or even a regular cookie-based session (most browsers [at least Firefox, Chrome, and Safari] have a “Copy as cURL” in their development tools, you can start with that and then remove different elements).

1 Like