Import Dashboard Via Curl fails

Hi there

I am trying to import a dashboard that exists on grafana via the api into another grafana instance.

I am getting the following error:
[{“fieldNames”:[“Dashboard”],“classification”:“RequiredError”,“message”:“Required”}.

Command being used:
curl -X POST --insecure -H “Authorization: Bearer $apikey” -H “Content-Type: application/json” -d @overviewdashboard.json http://grafana.staged-by-discourse.com/api/dashboards/db

The json file starts with:

  "annotations": {
    "list": [
      {   
        "builtIn": 1,
        "datasource": "-- rt --",
        "enable": true,
        "hide": true,
        "iconColor": "rgba(0, 211, 255, 1)",
        "name": "Annotations & Alerts",
        "type": "dashboard"
      }   
    ]   
  }

Is it because the json file does not start with:

{
  "dashboard": {
    "id": null,
    "uid": null,
    "title": "Production Overview",
    "tags": [ "templated" ],
    "timezone": "browser",
    "schemaVersion": 16,
    "version": 0
  },
  "folderId": 0,
  "overwrite": false
}
```**strong text**

You are using wrong API. Please use:

  • /api/dashboards/import for dashboards exported from UI
  • /api/dashboards/db for dashboards exported from API /api/dashboards/uid/:uid

See examples in READMEs:

When using that api I get the following:

{“error”:“Server Error”,“message”:“Internal Server Error - Check the Grafana server logs for the detailed error message.”}

Grafana log says:
t=2019-02-20T09:52:40+0000 lvl=eror msg=“Request Completed” logger=context userId=0 orgId=43 uname= method=POST path=/api/dashboards/import status=500 remote_addr=[::1] time_ms=32 size=122 referer=

How did you export json, which you are trying to import? Please provide all required information to reproduce your problem, otherwise nobody will be able to help you.