• /
  • Log in
  • Free account

NerdGraph tutorial template

This is a template. First, we recommend reading How to write NerdGraph docs.

The easiest way to create a NerdGraph tutorial is to clone an existing one that is fairly close to the functionality you're trying to document. This template below serves to explain why we use the general format we do.

Ideally the final version of your NerdGraph doc will include:

  • An introduction paragraph describing what problem or use case the users want to solve
  • Several example requests (whatever seems sufficient) to help users understand the functionality

Sample intro paragraph: You can use the New Relic GraphQL API to [add key use cases here]. To construct these queries and see responses, you can use the New Relic GraphQL Explorer. This document explains some of the available functions to query [data to be queried].

Example request #1

Add a description here for your example query. Tell users why they want to query this kind of data. Fill out the first block with your code, and the second with the data returned by the query:

{
   actor {
      account(id: YOUR_ACCOUNT_ID) {
         nrql(query: "SELECT count(*) FROM Transaction SINCE 1 HOUR AGO") {
            results
         }
      }
   }
}

This query returns the following:

{
   "data": {
      "actor": {
         "account": {
            "nrql": {
               "results": [
                 {
                  "count": 1000
                 }
                ]
            }
         }
      }
   }
}

Example request #2

Add a description here for your example query. Tell the customer why they want to query this kind of data. Fill out the first block with your code, and the second with the data returned by the query:

{
   actor {
      account(id: YOUR_ACCOUNT_ID) {
         nrql(query: "SELECT count(*) FROM Transaction SINCE 1 HOUR AGO") {
            results
         }
      }
   }
}

This query returns the following:

{
   "data": {
      "actor": {
         "account": {
            "nrql": {
               "results": [
                 {
                  "count": 1000
                 }
                ]
            }
         }
      }
   }
}

Example request #3

Add a description here for your example query. Tell the customer why they want to query this kind of data. Fill out the first block with your code, and the second with the data returned by the query:

{
   actor {
      account(id: YOUR_ACCOUNT_ID) {
         nrql(query: "SELECT count(*) FROM Transaction SINCE 1 HOUR AGO") {
            results
         }
      }
   }
}

This query returns the following:

{
   "data": {
      "actor": {
         "account": {
            "nrql": {
               "results": [
                 {
                  "count": 1000
                 }
                ]
            }
         }
      }
   }
}
Create issueEdit page
Copyright © 2022 New Relic Inc.