1
votes

I am trying to import existing json file using HTTP API, but the 'curl' command throwing the error.

I am using the below command to import existing json file,

curl --user admin:admin "http://localhost:3000/api/dashboards/db" -X POST -H "Content-Type:application/json;charset=UTF-8" --data-binary @/u04/sys_monitor/my_Metrics.json

If i run the above command, it is throwing the error like "[{"fieldNames":["Dashboard"],"classification":"RequiredError","message":"Required"}]"

I tried to run the below command,

curl --fail --insecure --user admin:admin --request "POST" "http://localhost:3000/api/dashboards/db" --header "Content-Type: application/json" --data-binary @/u04/sys_monitor/my_Metrics.json

For the above command execution i am getting the error like,

curl: (22) The requested URL returned error: 422 Unprocessable Entity

Where i am doing wrong, kindly assist me,

1

1 Answers

0
votes

The below comment is working but not updated the dashboard in grafana,

curl --user admin:admin -vvv "http://localhost:3000/api/dashboards/db" -X POST -d @My_Metrics.json -H 'Content-Type: application/json'