Forum Discussion

Joe_Williams's avatar
6 years ago

Rest API Cloning Dashboards

It would be nice to be able to clone dashboards via the API.

I have an onboarding system I wrote for some of our technicians that creates folders and collector groups and sets specific properties that are required for our ticketing system. It also creates use roles with the specific permissions, etc....

One of the items I want to be able to do is have a Default Dashboard group and list out the dashboards in there. Allowing them to chose which ones they want.

 

For the record I tried to be cheeky and used Developer Tools to see what was being done to clone a dashboard and I can't even use that to get it working. Comes up with 'HTTP Status 415 – Unsupported Media Type'.

  • Sarah_Terry's avatar
    Sarah_Terry
    Icon for Product Manager rankProduct Manager

    Hi @Joe Williams ,

    Thanks for posting! The historical difficulty here lies in the fact that there is no HTTP clone verb. That being said, we recognize the importance of being able to quickly reproduce dashboards & the widgets included (and making the GET / POST requests individually here can be cumbersome). The best current option is to GET the template for the dashboard and then POST a new dashboard using that template (which allows you to reproduce a dashboard and all widgets in 2 requests).

    Have you tried doing a GET + POST using dashboard templates via API, and if so can you provide more detail on the shortcomings of that option for your use case (e.g. unhappy with having to make two requests, takes too long, etc.)? 

    I think there is room for improvement on our end, perhaps we could add a convenience clone function into the SDK or implement the clone RESTfully directly in the API (e.g. adding a query parameter to the POST option for dashboards to clone from an existing dashboard). Can you also comment on whether you'd want the ability to change configuration during the clone, or whether you're looking for an exact clone & will edit / customize afterwards? I want to make sure we understand your full workflow.

    Thanks!

    Sarah

  • Not to speak for Joe but I know in my environment and as an MSP we have a template dashboard group that contains our standard templates we deploy when adding a new customer to LogicMonitor. These templates heavily use dashboard group tokens to customize it per customer. I scripted most of the complete onboarding process except for this dashboard group cloning. I actually pause the script and instruct the user to clone the group, then the script would continue and modify group tokens. At the time it looked too complex to attempt to script the cloning vs saving time of a few clicks to clone. The UI seems to have access to a /dashboard/groups/#/asyncclone?recursive=true method that is not available in the API. Something available like this would be very useful for us at least. Cloning individual dashboards would also be useful.

  • On 8/5/2019 at 2:23 PM, Joe Williams said:

    For the record I tried to be cheeky and used Developer Tools to see what was being done to clone a dashboard and I can't even use that to get it working. Comes up with 'HTTP Status 415 – Unsupported Media Type'.

    I was able to recently use the v2 REST API to clone dashboards. 

    1. 1. HTTP GET your "template" dashboard  via /dashboard/dashboards/{id} 
    2. 2. Modify the "template" to suit your need for the new clone, and deleting the following keys: id, template, userPermission, shareable, (and maybe groupName and groupFullPath, I was cloning private dashboards, so these keys don't apply to my immediate use case)
    3. 3. HTTP POST your modified "template" at /dashboard/dashboards/{id}/clone 

    *insert disclaimer about undocumented REST API features*