• /
  • Log in
  • Free account

NerdGraph tutorial: Move dashboards to other accounts

You can export your dashboards and import them into a new account using queries and mutations in NerdGraph.

Tip

You can also export your dashboards as an image.

To do so:

  1. Go to the GraphiQL explorer.
  2. Find out which dashboards are available.
  3. Export the desired dashboard.
  4. Import the selected dashboard into a new account.

List your dashboards

Use the following query to retrieve a list of your existing dashboards:

{
actor {
entitySearch(queryBuilder: {type: DASHBOARD}) {
results {
entities {
... on DashboardEntityOutline {
guid
name
accountId
}
}
}
}
}
}

Export a dashboard

Use the following query to export, then extract the dashboard's entity information from the output:

{
  actor {
    entity(guid: "your_guid_xxxxxxx") {
      ... on DashboardEntity {
        name
        permissions
        pages {
          name
          widgets {
            visualization { id }
            title
            layout { row width height column }
            rawConfiguration
          }
        }
      }
    }
  }
}

Example entity information in GraphiQL output:

dashboards_api_entity_section.png

Import a dashboard into a new account

Use the following mutation to import the dashboard into another account:

mutation create($dashboard: DashboardInput!) {
  dashboardCreate(accountId: your_new_AccountID, dashboard: $dashboard) {
    entityResult {
      guid
      name
    }
    errors {
      description
    }
  }
}

Follow these steps:

  1. In the Query variables section, name the entity dashboard (since we declared the input variable as $dashboard).
  2. Copy and paste the entity's output into the new account. It will be copied as an entity.
  3. Change entity to dashboard.

dashboards_api_paste_entity.png

Create issueEdit page
Copyright © 2022 New Relic Inc.