Specify data source when uploading dashboard using curl

If I upload a dashboard to Grafana using the web gui, I get the following dialog:

It asks to specify the Elastic data source, I select those and everything displays correctly.

If I upload the same dashboard via curl, I get errors in the dashboard as follows:


I think that’s because it wasn’t able to map the data sources in the file to the available data sources.

If I edit the graph, the data source it can’t map to is available in the drop down.

So, I can’t figure out why it can’t map the data sources. I am using Grafana 5.2

This is my curl command:

curl -u admin:admin -X POST -H 'Content-Type: application/json' -d '@ilb-dashboard.json' http://localhost:30089/grafana/api/dashboards/db