grafana-api-java-client icon indicating copy to clipboard operation
grafana-api-java-client copied to clipboard

Dashboard creation in JSON

Open AlexandreRio opened this issue 7 years ago • 1 comments

Is there a way to create a dashboard using a JSON export of an existing one? Just by looking at it it seems that it's the expected format http://docs.grafana.org/http_api/dashboard/#create-update-dashboard

What do you think of adding a new method to create a dashboard from a raw export instead of a created model?

AlexandreRio avatar Apr 06 '18 14:04 AlexandreRio

The code would look like this:

RequestBody body = RequestBody.create(MediaType.parse("Application/json"), grafanaRawDashboard);
Response<DashboardCreationResponse> response = service.postRawDashboard(apiKey, body).execute();

The benefit from using this approach is that I don't have to write POJOs for every dashboard part (I'm not sure they're all implemented in the models/) and it's way easier for big dashboards I just copy and paste.

So my question is do you like this idea, would it be merged if I make a PR?

AlexandreRio avatar Apr 11 '18 09:04 AlexandreRio