• Log inStart now

NerdGraph tutorial: view, create, and rename accounts

As an alternative to using the New Relic UI, you can use NerdGraph to view your organization's accounts, create accounts, and rename accounts.

Requirements

Requirements to manage accounts via NerdGraph include:

Before you start

Before you use NerdGraph to manage your accounts, it will probably help you to understand:

This tutorial will show you how to:

  • View accounts
  • Rename accounts
  • Add accounts

Tips on terms and fields

Some tips about some of the fields used in these requests:

  • The managedAccount and managedAccounts fields are simply terms for the accounts in an organization. They're synonymous with "accounts."
  • The regionCode field refers to the data center used by an account: US or EU. Note that an organization can only use a single data center: there can't be accounts that use different data centers in a single organization.

Note that the NerdGraph explorer has built-in docs that defines fields.

View accounts

Here's an example of returning the accounts in your organization:

{
actor {
organization {
accountManagement {
managedAccounts {
name
id
regionCode
}
}
}
}
}

Create accounts

Here's an example of how to create an account. Before creating an account, make sure you understand what an account is used for.

mutation {
  accountManagementCreateAccount(managedAccount: {name: "NEW_ACCOUNT_NAME"}) {
    managedAccount {
      id
      name
      regionCode
    }
  }
}

Rename an account

Here's an example of how to rename an account.

mutation {
  accountManagementUpdateAccount(managedAccount: {name: "UPDATED_ACCOUNT_NAME", id: 101010101}) {
    managedAccount {
      id
      name
      regionCode
    }
  }
}

Errors

Here are some errors and what they mean:

Error message

Likely cause

extensions: { nerdGraphExtensions: { errorClass: "ACCESS_DENIED" } }
}

This points to a problem with your organization structure (for example, an account that is outside the boundaries of an organization). If you get this message, contact support or your account representative.

cannot create subaccount -- multiple parent account ids found. Please use Partnership API.", {
extensions: { nerdGraphExtensions: { errorClass: "SERVER_ERROR" } }
}

This is a message returned when your organization has more than one "parent account," which is an indicator that your organization has a complex account structure that was set up with the Partnership API and requires the use of that API. Have questions? Contact support or your account representative.

Other errors

Contact support or your account representative.

Copyright © 2022 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.