API Stability Long-Term

The updateDashboard() GraphQL mutation may be used to update a dashboard in LogScale.

There are several other basic mutations related to dashboards. You can use the createDashboard() to create a new one. The renameDashboard() mutation is used to rename a dashboard. You can use copyDashboard() to clone an existing dashboard, and deleteDashboardV3() to delete one. To get a list of dashboards, use the dashboardsPage() query.

To make changes to a dashboard using the UI, see Manage repository dashboards in the main documentation.

Syntax

graphql
updateDashboard(
      input: UpdateDashboardInput!
   ): UpdateDashboardMutation!

Example

Below is an example of how this mutation field might be used:

Raw
graphql
mutation {
  updateDashboard( input:
    {
      id: "8yHvhPf8GJHDZaP9MRrCSlcvfcbHyInY",
      name: "New Name",
      description: "New Description"
    }
  )
  { dashboard { id } }
}
Mac OS or Linux (curl)
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -d @- << EOF
{"query" : "mutation {
  updateDashboard( input:
    {
      id: \"8yHvhPf8GJHDZaP9MRrCSlcvfcbHyInY\",
      name: \"New Name\",
      description: \"New Description\"
    }
  )
  { dashboard { id } }
}"
}
EOF
Mac OS or Linux (curl) One-line
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql \
    -H "Authorization: Bearer $TOKEN" \
    -H "Content-Type: application/json" \
    -d @- << EOF
{"query" : "mutation {
  updateDashboard( input:
    {
      id: \"8yHvhPf8GJHDZaP9MRrCSlcvfcbHyInY\",
      name: \"New Name\",
      description: \"New Description\"
    }
  )
  { dashboard { id } }
}"
}
EOF
Windows Cmd and curl
shell
curl -v -X POST $YOUR_LOGSCALE_URL/graphql ^
    -H "Authorization: Bearer $TOKEN" ^
    -H "Content-Type: application/json" ^
    -d @'{"query" : "mutation { ^
  updateDashboard( input: ^
    { ^
      id: \"8yHvhPf8GJHDZaP9MRrCSlcvfcbHyInY\", ^
      name: \"New Name\", ^
      description: \"New Description\" ^
    } ^
  ) ^
  { dashboard { id } } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  updateDashboard( input:
    {
      id: \"8yHvhPf8GJHDZaP9MRrCSlcvfcbHyInY\",
      name: \"New Name\",
      description: \"New Description\"
    }
  )
  { dashboard { id } }
}"
}'
    "$YOUR_LOGSCALE_URL/graphql"
Perl
perl
#!/usr/bin/perl

use HTTP::Request;
use LWP;

my $TOKEN = "TOKEN";

my $uri = '$YOUR_LOGSCALE_URL/graphql';

my $query = "mutation {
  updateDashboard( input:
    {
      id: \"8yHvhPf8GJHDZaP9MRrCSlcvfcbHyInY\",
      name: \"New Name\",
      description: \"New Description\"
    }
  )
  { dashboard { id } }
}";
$query =~ s/\n/ /g;
my $json = sprintf('{"query" : "%s"}',$query);
my $req = HTTP::Request->new("POST", $uri );

$req->header("Authorization" => "Bearer $TOKEN");
$req->header("Content-Type" => "application/json");

$req->content( $json );

my $lwp = LWP::UserAgent->new;

my $result = $lwp->request( $req );

print $result->{"_content"},"\n";
Python
python
#! /usr/local/bin/python3

import requests

url = '$YOUR_LOGSCALE_URL/graphql'
mydata = r'''{"query" : "mutation {
  updateDashboard( input:
    {
      id: \"8yHvhPf8GJHDZaP9MRrCSlcvfcbHyInY\",
      name: \"New Name\",
      description: \"New Description\"
    }
  )
  { dashboard { id } }
}"
}'''

resp = requests.post(url,
                     data = mydata,
                     headers = {
   "Authorization" : "Bearer $TOKEN",
   "Content-Type" : "application/json"
}
)

print(resp.text)
Node.js
javascript
const https = require('https');

const data = JSON.stringify(
    {"query" : "mutation {
  updateDashboard( input:
    {
      id: \"8yHvhPf8GJHDZaP9MRrCSlcvfcbHyInY\",
      name: \"New Name\",
      description: \"New Description\"
    }
  )
  { dashboard { id } }
}"
}
);


const options = {
  hostname: '$YOUR_LOGSCALE_URL',
  path: 'graphql',
  port: 443,
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Content-Length': data.length,
    Authorization: 'BEARER ' + process.env.TOKEN,
    'User-Agent': 'Node',
  },
};

const req = https.request(options, (res) => {
  let data = '';
  console.log(`statusCode: ${res.statusCode}`);

  res.on('data', (d) => {
    data += d;
  });
  res.on('end', () => {
    console.log(JSON.parse(data).data);
  });
});

req.on('error', (error) => {
  console.error(error);
});

req.write(data);
req.end();
Example Responses
Success (HTTP Response Code 200 OK)
json
{
  "data": {
    "updateDashboard": {
      "dashboard": {
        "id": "8yHvhPf8GJHDZaP9MRrCSlcvfcbHyInY"
      }
    }
  }
}

Given Datatype

For this input datatype, you would provide the name of the dashboard, and possibly a list of widgets to include in the dashboard, any filters and labels, and a few other factors. These are listed and explained, along with other parameters, in the table below:

Table: UpdateDashboardInput

ParameterTypeRequiredDefaultStabilityDescription
Some arguments may be required, as indicated in the Required column. For return datatypes, this indicates that you must specify which fields you want returned in the results.
Table last updated: Sep 23, 2024
defaultFilterIdstring  Long-TermThe unique identifier for the default filter.
defaultSharedTimeEnabledboolean  Long-TermWhether the default shared time is enabled.
defaultSharedTimeEndstring  Long-TermThe updated default shared time end for the dashboard.
defaultSharedTimeStartstring  Long-TermThe updated default shared time start for the dashboard.
descriptionstring  Long-TermAn updated description of the dashboard.
filters[FilterInput]yes Long-TermThe filters for the dashboard. See FilterInput.
idstringyes Long-TermThe unique identifier of the dashboard to update.
labels[string]yes Long-TermThe labels for the dashboard being updated.
links[LinkInput]yes Long-TermAll dashboard links. See LinkInput.
namestring  Long-TermThe name of the dashboard to update.
parameters[ParameterInput]yes Long-TermThe dashboard parameters. See ParameterInput.
timeJumpSizeInMsinteger  Long-TermThe skip time in milliseconds for the dashboard.
updateFrequencyDashboardUpdateFrequencyInput  Long-TermThe frequency in which the dashboard is to be updated. See DashboardUpdateFrequencyInput.
widgets[WidgetInput]yes Long-TermThe dashboards widgets. See WidgetInput.

Returned Datatype

The returned datatype, through sub-parameters, provide much information the dashboard. The table below contains a link to the table with the sub-parameters:

Table: UpdateDashboardMutation

ParameterTypeRequiredDefaultStabilityDescription
Some arguments may be required, as indicated in the Required column. For return datatypes, this indicates that you must specify which fields you want returned in the results.
Table last updated: Oct 4, 2024
dashboardDashboardyes Long-TermThe dashboard to update. See Dashboard.