Forum Discussion

Joe_Williams's avatar
Joe_Williams
Icon for Professor rankProfessor
6 years ago

Cloning Dashboard Groups With Rest

Is there a way to clone a dashboard group? I am automating our onboard procedure for customers and this is one of the last steps.

Currently I have a form that will automatically create a collector group, resource group, user role, etc.... But I can't seem to clone a dashboard group.

I tried to do the sneaky backdoor way and use developer tools to show me the rest calls, but I keep getting back 415 Unsupported Media Type

My Postman attempts look like this.

{{url}}/dashboard/groups/18/asyncclone?recursive=true

{
    "name": "TestCustomer1",
    "description": "",
    "parentId": "1",
    "widgetTokens": [
        {
            "name": "CompanyName",
            "value": "TestCustomer1"
        },
        {
            "name": "defaultResourceGroup",
            "value": "BaseGroup/Onboarding/TestCustomer1"
        }
    ]
}

Where 18 is the ID of the default dashboards group.

  • Ultimately I will be using PHP, but the above example/code was from Postman.

    Attached is a screenshot of Postman.

  • I would like this too. I believe I attempted to use asyncclone in the past but it's not exposed in the API, even unofficially.

     

  • Forgive me if you have already tried and discounted this for whatever reason, but my first thought is to

    1. 1) GET the json for the current "Template" using the rest API to get the entirety of its definition
    2. 2) Change the JSON to match the changes you need made to that (customer name, team name, project name)
    3. 3) POST the changed JSON to make the new group
    4. 4) Build a recursive function to walk that hierarchy
    5. 5) Grab each of the dashboards and change the appliesto to match the new set of devices
      1.     a)I'm currently doing that piece with a token at the directory level for each of our customers that I can then just change at the dashboard group level to make a full dashboard suite for them.
      2. 6) Duplicate each of those to the new dashboard group, and change the token.
  • 1 minute ago, Cole McDonald said:

    Forgive me if you have already tried and discounted this for whatever reason, but my first thought is to

    1. 1) GET the json for the current "Template" using the rest API to get the entirety of its definition
    2. 2) Change the JSON to match the changes you need made to that (customer name, team name, project name)
    3. 3) POST the changed JSON to make the new group
    4. 4) Build a recursive function to walk that hierarchy
    5. 5) Grab each of the dashboards and change the appliesto to match the new set of devices
      1.     a)I'm currently doing that piece with a token at the directory level for each of our customers that I can then just change at the dashboard group level to make a full dashboard suite for them.
      2. 6) Duplicate each of those to the new dashboard group, and change the token.

    This is the way I will end up probably going, but was hoping I didn't have to go through all of that. I just wanted to simply clone it.

  • yeah... I always just assume I'm going to have to build it by hand... not just Logic Monitor, everything.  It's in my DNA though, I started programming when, if you wanted software that did a specific thing, you had to write it. (back in the punch card and teletype days).