# Dashboard API - Returns query results as well?

**URL:** <https://community.grafana.com/t/dashboard-api-returns-query-results-as-well/5556>\
**Category:** Grafana\
**Created:** [February 19, 2018, 5:08am UTC](https://community.grafana.com/t/dashboard-api-returns-query-results-as-well/5556 "2018-02-19T05:08:14Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![defensivedepth](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/defensivedepth/32/2732_2.png) [@defensivedepth](https://community.grafana.com/u/defensivedepth)\
**Post date:** [February 19, 2018, 5:08am UTC](https://community.grafana.com/t/dashboard-api-returns-query-results-as-well/5556/1 "2018-02-19T05:08:15Z")

</div>

This is probably obvious, but the documentation is not extremely clear and my testing is inconclusive:

Is GET /api/dashboards/uid/:uid supposed to return both the dashboard meta/model & resulting data from the panel queries, or just the dashboard meta/model?

---

<div class="post-metadata">

**Author:** ![daniellee](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/daniellee/32/41_2.png) [@daniellee](https://community.grafana.com/u/daniellee)\
**Post date:** [February 19, 2018, 4:32pm UTC](https://community.grafana.com/t/dashboard-api-returns-query-results-as-well/5556/2 "2018-02-19T16:32:58Z")

</div>

Just the dashboard and meta models. The dashboard model contains an array of panels and each panel has a targets property which contains the panel query (or queries):

```json
      "targets": [
        {
          "refId": "A",
          "target": "scale(apps.backend.backend_03.counters.requests.count, 0.3)"
        }
      ],

```

When the dashboard is refreshed, Grafana loops through all the queries and calls the appropriate data source with the query from the panel.

---

<div class="post-metadata">

**Author:** ![defensivedepth](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/defensivedepth/32/2732_2.png) [@defensivedepth](https://community.grafana.com/u/defensivedepth)\
**Post date:** [February 19, 2018, 4:58pm UTC](https://community.grafana.com/t/dashboard-api-returns-query-results-as-well/5556/3 "2018-02-19T16:58:58Z")

</div>

Thanks!

I am trying to generate a snapshot of the dashboard through the API (api/snapshots), but it is not clear to me how to programmatically get the panel data to post to the snapshot API. That is why I was trying to query the dashboard.

What am I missing?

---

<div class="post-metadata">

**Author:** ![daniellee](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/daniellee/32/41_2.png) [@daniellee](https://community.grafana.com/u/daniellee)\
**Post date:** [February 19, 2018, 5:07pm UTC](https://community.grafana.com/t/dashboard-api-returns-query-results-as-well/5556/4 "2018-02-19T17:07:43Z")

</div>

Unfortunately, this is currently hard to do:

> [@Save snapshot to grafana database](https://community.grafana.com/t/save-snapshot-to-grafana-database/5419/2):
>
> Creating a snapshot via the api is unfortunately very hard to use externally. The problem is that the snapshot data is saved in the dashboard json on the Grafana frontend and then the dashboard json with the embedded snapshot data is sent to the api. Basically, you need the Grafana frontend to generate a snapshot. The API just saves the result. It is on our TODO list to make a better API for snapshotting that uses headless chrome to be able to do a server side render of a panel. See this issue…

I’ll see if I can find a better way to do this with the current API.

---

<div class="post-metadata">

**Author:** ![defensivedepth](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/defensivedepth/32/2732_2.png) [@defensivedepth](https://community.grafana.com/u/defensivedepth)\
**Post date:** [February 19, 2018, 5:55pm UTC](https://community.grafana.com/t/dashboard-api-returns-query-results-as-well/5556/5 "2018-02-19T17:55:46Z")

</div>

Thanks, that was the conclusion I was coming to.

---

<div class="post-metadata">

**Author:** ![defensivedepth](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/defensivedepth/32/2732_2.png) [@defensivedepth](https://community.grafana.com/u/defensivedepth)\
**Post date:** [March 6, 2018, 1:34pm UTC](https://community.grafana.com/t/dashboard-api-returns-query-results-as-well/5556/6 "2018-03-06T13:34:45Z")

</div>

@daniellee This is hacky, but it works for my use-case - it just simulates clicking on the generate snapshot link. Using Apify’s synchronous API, the API call will return the snapshot URL.

[https://www.apify.com/defensivedepth/grafana-generate-snapshots](https://www.apify.com/defensivedepth/grafana-generate-snapshots)

---

<div class="post-metadata">

**Author:** ![meyerder](https://avatars.discourse-cdn.com/v4/letter/m/b9bd4f/32.png) [@meyerder](https://community.grafana.com/u/meyerder)\
**Post date:** [March 6, 2018, 2:34pm UTC](https://community.grafana.com/t/dashboard-api-returns-query-results-as-well/5556/7 "2018-03-06T14:34:25Z")

</div>

daniellee:

Is there a means to return just the data (results) in a json format vs all the data for the panel?

---

<div class="post-metadata">

**Author:** ![daniellee](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/daniellee/32/41_2.png) [@daniellee](https://community.grafana.com/u/daniellee)\
**Post date:** [March 9, 2018, 8:45am UTC](https://community.grafana.com/t/dashboard-api-returns-query-results-as-well/5556/8 "2018-03-09T08:45:49Z")

</div>

Not really. Grafana takes the dashboard json, parses out the queries for each panel and executes them.

So you could do the same thing but that would be quite a lot of code (template variables, different data sources, series overrides, timeshift overrides etc., ) - basically the whole dashboard rendering javascript from Grafana.

---

<div class="post-metadata">

**Author:** ![defensivedepth](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/defensivedepth/32/2732_2.png) [@defensivedepth](https://community.grafana.com/u/defensivedepth)\
**Post date:** [November 6, 2018, 9:52pm UTC](https://community.grafana.com/t/dashboard-api-returns-query-results-as-well/5556/9 "2018-11-06T21:52:45Z")

</div>

@daniellee Has there been any further movement on this issue? RE: creating a snapshot via the API.

Thanks!
