# Cannot import the dashboard via api

**URL:** <https://community.grafana.com/t/cannot-import-the-dashboard-via-api/19373>\
**Category:** Grafana\
**Tags:** api\
**Created:** [July 16, 2019, 11:58am UTC](https://community.grafana.com/t/cannot-import-the-dashboard-via-api/19373 "2019-07-16T11:58:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![clandestinobgd](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/clandestinobgd/32/3200_2.png) [@clandestinobgd](https://community.grafana.com/u/clandestinobgd)\
**Post date:** [July 16, 2019, 11:58am UTC](https://community.grafana.com/t/cannot-import-the-dashboard-via-api/19373/1 "2019-07-16T11:58:31Z")

</div>

Hello,  
I am trying to import the dashboard via API. Hitting 500 from grafana.  
Tried with 6.0 and 6.3-beta1, the same OS: Ubuntu, 16.04.  
Grafana runs as systemd service.

Any idea?

Thanks,  
Milan

Here is the curl:

`curl -XPOST http://admin:admin@community.grafana.com/api/dashboards/import -H "Content-Type: application/json" --data-binary @/Users/agaton/jvm.json`

And here is the exception:

```auto
Jul 16 13:29:09 jumio-bi grafana-server[8109]: t=2019-07-16T13:29:09+0200 lvl=eror msg="Request error" logger=context userId=1 orgId=1 uname=admin error="runtime error: invalid memory address or nil pointer dereference" stack="/usr/local/
go/src/runtime/panic.go:82 (0x44e200)\n/usr/local/go/src/runtime/signal_unix.go:390 (0x44e02f)\n/go/src/github.com/grafana/grafana/pkg/components/simplejson/simplejson.go:142 (0xa2fd41)\n/go/src/github.com/grafana/grafana/pkg/components/s
implejson/simplejson.go:142 (0xa2fd41)\n/go/src/github.com/grafana/grafana/pkg/models/dashboards.go:130 (0xa2fd40)\n/go/src/github.com/grafana/grafana/pkg/plugins/dashboard_importer.go:55 (0xc7e994)\n/usr/local/go/src/reflect/value.go:447
 (0x491bf0)\n/usr/local/go/src/reflect/value.go:308 (0x491673)\n/go/src/github.com/grafana/grafana/pkg/bus/bus.go:131 (0xa22651)\n/go/src/github.com/grafana/grafana/pkg/bus/bus.go:216 (0x124a003)\n/go/src/github.com/grafana/grafana/pkg/ap
i/plugins.go:194 (0x1249fe1)\n/usr/local/go/src/reflect/value.go:447 (0x491bf0)\n/usr/local/go/src/reflect/value.go:308 (0x491673)\n/go/src/github.com/grafana/grafana/vendor/github.com/go-macaron/inject/inject.go:177 (0x81a5c6)\n/go/src/g
ithub.com/grafana/grafana/vendor/github.com/go-macaron/inject/inject.go:137 (0x819ebb)\n/go/src/github.com/grafana/grafana/pkg/api/common.go:37 (0x126160d)\n/usr/local/go/src/reflect/value.go:447 (0x491bf0)\n/usr/local/go/src/reflect/valu
e.go:308 (0x491673)\n/go/src/github.com/grafana/grafana/vendor/github.com/go-macaron/inject/inject.go:177 (0x81a5c6)\n/go/src/github.com/grafana/grafana/vendor/github.com/go-macaron/inject/inject.go:137 (0x819ebb)\n/go/src/github.com/graf
ana/grafana/vendor/gopkg.in/macaron.v1/context.go:121 (0x81b679)\n/go/src/github.com/grafana/grafana/vendor/gopkg.in/macaron.v1/context.go:112 (0xbace4e)\n/go/src/github.com/grafana/grafana/pkg/middleware/request_tracing.go:25 (0xbace41)\
n/usr/local/go/src/reflect/value.go:447 (0x491bf0)\n/usr/local/go/src/reflect/value.go:308 (0x491673)\n/go/src/github.com/grafana/grafana/vendor/github.com/go-macaron/inject/inject.go:177 (0x
Jul 16 13:29:09 jumio-bi grafana-server[8109]: 81a5c6)\n/go/src/github.com/grafana/grafana/vendor/github.com/go-macaron/inject/inject.go:137 (0x819ebb)\n/go/src/github.com/grafana/grafana/vendor/gopkg.in/macaron.v1/context.go:121 (0x81b67
9)\n/go/src/github.com/grafana/grafana/vendor/gopkg.in/macaron.v1/context.go:112 (0xbac66c)\n/go/src/github.com/grafana/grafana/pkg/middleware/request_metrics.go:17 (0xbac657)\n/usr/local/go/src/reflect/value.go:447 (0x491bf0)\n/usr/local
/go/src/reflect/value.go:308 (0x491673)\n/go/src/github.com/grafana/grafana/vendor/github.com/go-macaron/inject/inject.go:177 (0x81a5c6)\n/go/src/github.com/grafana/grafana/vendor/github.com/go-macaron/inject/inject.go:137 (0x819ebb)\n/go
/src/github.com/grafana/grafana/vendor/gopkg.in/macaron.v1/context.go:121 (0x81b679)\n/go/src/github.com/grafana/grafana/vendor/gopkg.in/macaron.v1/context.go:112 (0xbac585)\n/go/src/github.com/grafana/grafana/pkg/middleware/recovery.go:1
47 (0xbac573)\n/go/src/github.com/grafana/grafana/vendor/gopkg.in/macaron.v1/context.go:79 (0x81b520)\n/go/src/github.com/grafana/grafana/vendor/github.com/go-macaron/inject/inject.go:157 (0x81a280)\n/go/src/github.com/grafana/grafana/ven
dor/github.com/go-macaron/inject/inject.go:135 (0x819faa)\n/go/src/github.com/grafana/grafana/vendor/gopkg.in/macaron.v1/context.go:121 (0x81b679)\n/go/src/github.com/grafana/grafana/vendor/gopkg.in/macaron.v1/context.go:112 (0xba9a9b)\n/
go/src/github.com/grafana/grafana/pkg/middleware/logger.go:34 (0xba9a86)\n/usr/local/go/src/reflect/value.go:447 (0x491bf0)\n/usr/local/go/src/reflect/value.go:308 (0x491673)\n/go/src/github.com/grafana/grafana/vendor/github.com/go-macaro
n/inject/inject.go:177 (0x81a5c6)\n/go/src/github.com/grafana/grafana/vendor/github.com/go-macaron/inject/inject.go:137 (0x819ebb)\n/go/src/github.com/grafana/grafana/vendor/gopkg.in/macaron.v1/context.go:121 (0x81b679)\n/go/src/github.co
m/grafana/grafana/vendor/gopkg.in/macaron.v1/router.go:187 (0x82ca26)\n/go/src/github.com/grafana/grafana/vendor/gopkg.in/macaron.v1/router.go:294 (0x82743d)\n/go/src/github.com/grafana/grafa
Jul 16 13:29:09 jumio-bi grafana-server[8109]: na/vendor/gopkg.in/macaron.v1/macaron.go:220 (0x8206cc)\n/usr/local/go/src/net/http/server.go:2774 (0x6f13b7)\n/usr/local/go/src/net/http/server.go:1878 (0x6ed0a0)\n/usr/local/go/src/runtime/
asm_amd64.s:1337 (0x4680e0)\n"
Jul 16 13:29:09 jumio-bi grafana-server[8109]: t=2019-07-16T13:29:09+0200 lvl=eror msg="Request Completed" logger=context userId=1 orgId=1 uname=admin method=POST path=/api/dashboards/import status=500 remote_addr=192.168.9.252 time_ms=20
6 size=122 referer=

```

The json is saved from [https://grafana.com/grafana/dashboards/4701](https://grafana.com/grafana/dashboards/4701)

---

<div class="post-metadata">

**Author:** ![jangaraj](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/jangaraj/32/39197_2.png) [@jangaraj](https://community.grafana.com/u/jangaraj)\
**Post date:** [July 16, 2019, 1:33pm UTC](https://community.grafana.com/t/cannot-import-the-dashboard-via-api/19373/2 "2019-07-16T13:33:30Z")

</div>

1.) Used endpoint is not officially available API endpoint (it is not documented [https://grafana.com/docs/http\_api/dashboard/](https://grafana.com/docs/http_api/dashboard/))

2.) That dashboard has a input variable, so you need to define it first. See example: [https://github.com/monitoringartist/grafana-aws-cloudwatch-dashboards#grafana-dashboards-for-aws-cloudwatch](https://github.com/monitoringartist/grafana-aws-cloudwatch-dashboards#grafana-dashboards-for-aws-cloudwatch)  
Because it is not documented API 1.), so exact parameters may depends on used Grafana version.

---

<div class="post-metadata">

**Author:** ![clandestinobgd](https://sea2.discourse-cdn.com/grafana/user_avatar/community.grafana.com/clandestinobgd/32/3200_2.png) [@clandestinobgd](https://community.grafana.com/u/clandestinobgd)\
**Post date:** [July 16, 2019, 1:40pm UTC](https://community.grafana.com/t/cannot-import-the-dashboard-via-api/19373/3 "2019-07-16T13:40:40Z")

</div>

thanks for the reply.

1. ok
2. Tried with several other client dashboards, that do not have \_input declared. Same result.
