Error creating dashboard via http api

I am having trouble with a dashboard json import. I have a dashboard json, that when I import it into grafana works perfectly. The dashboard is correct. When I try to create the a dashboard using the api, it gives me a 400 - Bad Request error. I have validated the json with an online tool. I run the json through a regex to remove hidden ctl characters etc. I am stuck. Just can’t figure out how to validate the json I have when grafana itself will gladly accept it via the dashboard import feature. How can I get more details about the error?

Grafana dashboard export functionality from the UI (browser) doesn’t generate JSON dashboard model, which is accepted by Dashboard HTTP API | Grafana Labs
If you want to prove that just export some existing dashboard via API and then via UI and compare (JSON models will be similar, but not the same).

Of course you may hack it and use “UI” endpoint /api/dashboards/import for the import. But it’s not officially documented API, so it can be changed in any new Grafana release. You can find inspiration in the readme: GitHub - monitoringartist/grafana-aws-cloudwatch-dashboards: 30+ Grafana dashboards for AWS CloudWatch metrics: EC2, Lambda, S3, ELB, EMR, EBS, SNS, SES, SQS, RDS, EFS, ElastiCache, Billing, API Gateway, VPN, Step Functions, Route 53, CodeBuild, ...

This topic was automatically closed after 365 days. New replies are no longer allowed.