Cannot import the dashboard via api

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@localhost:3000/api/dashboards/import -H "Content-Type: application/json" --data-binary @/Users/agaton/jvm.json

And here is the exception:

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

1.) Used endpoint is not officially available API endpoint (it is not documented 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
Because it is not documented API 1.), so exact parameters may depends on used Grafana version.

thanks for the reply.

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