3

While importing the dashboard, API is not returning proper dashboard ID.

For all the dashboard ID it provides id as 0

If I check the dashboard using Chrome Devtools > Network tab, I'm able to get some id (in increment order).

What Grafana version are you using?

5.2.0-beta3 (previously using 5.1.4)

What datasource are you using?

InfluxDB

What OS are you running grafana on?

Windows 10 Pro

What did you do?

Imported the dashboard using Grafana API

What was the expected result?

Should be able to import the dashboard and as response it should return a dashboard ID

What happened instead?

Able to import the dashboard but not getting proper dashboard ID. For all dashboard it gives ID=0

import requests
url='http://admin:admin@localhost:3000/api/dashboards/import'
data='''{
  "dashboard": {}
  "folderId": 8,
  "overwrite": false
}'''
headers={"Content-Type": 'application/json'}
response = requests.post(url, data=data,headers=headers)
print(response)
print(response.status_code)
print (response.text)

Response

Response [200]
200
{
    "pluginId": "",
    "title": "Template dfsad",
    "imported": true,
    "importedUri": "db/template-dfsad",
    "importedUrl": "/d/uid1098/template-dfsad",
    "slug": "",
    "dashboardId": 0,
    "folderId": 8,
    "importedRevision": 1,
    "revision": 1,
    "description": "",
    "path": "",
    "removed": false
}
Mahadev Gouda
  • 769
  • 11
  • 14

0 Answers0