|
| 1 | +--- |
| 2 | +title: "NerdGraph tutorial: Create, update, and revoke public sharing dashboard URLs" |
| 3 | +tags: |
| 4 | + - share dashboards externally |
| 5 | + - share dashboards using NerdGraph |
| 6 | + - public dashboard |
| 7 | + - public dashboard URL |
| 8 | +metaDescription: Use New Relic NerdGraph to create, update, and revoke live dashboard URLs |
| 9 | +freshnessValidatedDate: never |
| 10 | +--- |
| 11 | + |
| 12 | +With the necessary [security and access set up](/docs/query-your-data/explore-query-data/dashboards/prerequisites-to-share-dashboards-charts) you can create, manage, and revoke publicly accessible live dashboard URLs using queries and mutations in [NerdGraph](/docs/apis/nerdgraph/get-started/introduction-new-relic-nerdgraph), |
| 13 | +You can also do it from the [New Relic UI](/docs/query-your-data/explore-query-data/dashboards/share-charts-dashboards-externally/#dashboard). |
| 14 | + |
| 15 | +<Callout variant="caution"> |
| 16 | + Anyone with the live dashboard or chart URLs can view all the information from the dashboard. Share information carefully and in accordance with your company's internal policies and procedures. |
| 17 | +</Callout> |
| 18 | + |
| 19 | +For creating, updating, or revoking a publicly accessible live dashboard URL from NerdGraph, you need the GUID of the dashboard you want to share. |
| 20 | + |
| 21 | +1. Go to <DNT>**[one.newrelic.com > Dashboards](https://one.newrelic.com//dashboards)**</DNT>. |
| 22 | +2. Open the dashboard you want to share. |
| 23 | +3. Navigate to <DNT>**<Icon name="fe-more-horizontal"/> > Metadata**</DNT>, and copy the entity GUID of the dasboard. |
| 24 | + |
| 25 | +<CollapserGroup> |
| 26 | +<Collapser id="create-dashboard-url-nerdgraph" title="Create a live dashboard URL"> |
| 27 | +1. Go to [NerdGraph API explorer](https://one.newrelic.com/nerdgraph-graphiql). |
| 28 | +2. Construct a [graph API call](/docs/apis/nerdgraph/get-started/nerdgraph-explorer) using the following details: |
| 29 | + * **Mutation**: `dashboardCreateLiveUrl` |
| 30 | + * **GUID**: The entity guide of the dashboard |
| 31 | + * **Options**(optional): The time period in seconds for the URL to be live |
| 32 | + * **Minimum value**: 300 seconds (5 minutes) |
| 33 | + * **Maximum value**: 631152000 seconds (20 years) |
| 34 | + * **Default value**: 2592000 seconds (30 days) |
| 35 | + * **Response**: `url` |
| 36 | + |
| 37 | + ``` |
| 38 | + mutation CreatePublicLink { |
| 39 | + dashboardCreateLiveUrl( |
| 40 | + guid: "enter the dashboard GUID" |
| 41 | + options: { ttl: "updated duration in seconds" } |
| 42 | + ) { |
| 43 | + url |
| 44 | + } |
| 45 | + } |
| 46 | +
|
| 47 | + ``` |
| 48 | +The live dashboard URL appears in the response. This is a public URL, so you can share it with anyone. |
| 49 | + |
| 50 | + ``` |
| 51 | + https://share.newrelic.com/dashboard/<public_link_id> |
| 52 | +
|
| 53 | + ``` |
| 54 | +The `<public_link_id>` is the ID of the shared dashboard. You can use it to update or revoke the shared dashboard URL through NerdGraph. |
| 55 | + |
| 56 | +<Callout variant="important"> |
| 57 | + Any content update in the dashboard on New Relic platform reflects in the shared dashboard page. |
| 58 | +</Callout> |
| 59 | + |
| 60 | +</Collapser> |
| 61 | + |
| 62 | +<Collapser id="update-dashboard-url-nerdgraph" title="Update a live dashboard URL"> |
| 63 | +Make sure you have the [permissions](/docs/query-your-data/explore-query-data/dashboards/prerequisites-to-share-dashboards-charts/#permissions-to-custom-role) to modify the configuration of the shared dashboard. |
| 64 | + |
| 65 | +To update the time period for the URL to be live: |
| 66 | +1. Go to [NerdGraph API explorer](https://one.newrelic.com/nerdgraph-graphiql). |
| 67 | +2. Construct a [graph API call](/docs/apis/nerdgraph/get-started/nerdgraph-explorer) using the following details: |
| 68 | + * **Mutation**: `dashboardUpdateLiveUrl` |
| 69 | + * **ID**: The ID of the shared dashboard (Copy it from the shared dashboard URL.) |
| 70 | + * **Options**: The updated time period in seconds |
| 71 | + * **Minimum value**: 300 seconds (5 minutes) |
| 72 | + * **Maximum value**: 631152000 seconds (20 years) |
| 73 | + * **Default value**: 2592000 seconds (30 days) |
| 74 | + |
| 75 | + ``` |
| 76 | + mutation UpdatePublicLink{ |
| 77 | + dashboardUpdateLiveUrl( |
| 78 | + id:"enter the public link ID" |
| 79 | + options: { ttl: "updated duration in seconds" } |
| 80 | + ) { |
| 81 | + title |
| 82 | + url |
| 83 | + } |
| 84 | + } |
| 85 | +
|
| 86 | + ``` |
| 87 | +The URL appears in the response as follows. Now the URL will remain live for the updated time period. |
| 88 | + |
| 89 | + ``` |
| 90 | + https://share.newrelic.com/dashboard/<public_link_id> |
| 91 | +
|
| 92 | + ``` |
| 93 | + |
| 94 | +</Collapser> |
| 95 | + |
| 96 | +<Collapser id="revoke-dashboard-url-nerdgraph" title="Revoke a live dashboard URL"> |
| 97 | +Based on the [permissions](/docs/query-your-data/explore-query-data/dashboards/prerequisites-to-share-dashboards-charts/#permissions-to-custom-role) you have, you can revoke only the URLs you have created, or all URLs created by users in the account. To revoke a shared dashboard URL: |
| 98 | +1. Go to [NerdGraph API explorer](https://one.newrelic.com/nerdgraph-graphiql). |
| 99 | +2. Construct a [graph API call](/docs/apis/nerdgraph/get-started/nerdgraph-explorer) using the following details: |
| 100 | + * **Mutation**: `dashboardRevokeLiveUrl` |
| 101 | + * **ID**: The ID of the shared dashboard (Copy it from the shared dashboard URL.) |
| 102 | + |
| 103 | + ``` |
| 104 | + mutation { |
| 105 | + dashboardRevokeLiveUrl(id: "<public_link_id>") { |
| 106 | + id |
| 107 | + } |
| 108 | + } |
| 109 | +
|
| 110 | + ``` |
| 111 | +The shared dashboard URL is now revoked, and it will no longer be accessible. The response appears as follows: |
| 112 | + |
| 113 | + ``` |
| 114 | + { |
| 115 | + "data": { |
| 116 | + "dashboardRevokeLiveUrl": { |
| 117 | + "id": "<public_link_id>" //the one you passed to the mutation |
| 118 | + } |
| 119 | + } |
| 120 | + } |
| 121 | +
|
| 122 | + ``` |
| 123 | +</Collapser> |
| 124 | + |
| 125 | +<Collapser id="list-dashboard-url-nerdgraph" title="List all shared dashboard URLs"> |
| 126 | +Based on the [permissions](/docs/query-your-data/explore-query-data/dashboards/prerequisites-to-share-dashboards-charts/#permissions-to-custom-role) you have, you can retrieve the list of links you have created, or all links created by users in the account. To get the list of shared dashboard URLs: |
| 127 | +1. Go to [NerdGraph API explorer](https://one.newrelic.com/nerdgraph-graphiql). |
| 128 | +2. Construct a [graph API call](/docs/apis/nerdgraph/get-started/nerdgraph-explorer) using the following details: |
| 129 | + * **Query**: `dashboard` |
| 130 | + * **Response**: `liveUrls` |
| 131 | + |
| 132 | + ``` |
| 133 | + { |
| 134 | + actor { |
| 135 | + user { |
| 136 | + name |
| 137 | + } |
| 138 | + dashboard { |
| 139 | + liveUrls(filter: {type: DASHBOARD}) { |
| 140 | + liveUrls { |
| 141 | + createdAt |
| 142 | + type |
| 143 | + uuid |
| 144 | + } |
| 145 | + } |
| 146 | + } |
| 147 | + } |
| 148 | + } |
| 149 | +
|
| 150 | + ``` |
| 151 | + |
| 152 | + The list of the shared dashboard URLs appears in response. |
| 153 | +</Collapser> |
| 154 | + |
| 155 | + |
| 156 | +</CollapserGroup> |
0 commit comments