Summary

Use removeDashboardLabels() to remove one or more labels from a dashboard. The mutation returns the updated dashboard on success, or null with errors on failure.

Syntax

graphql
removeDashboardLabels(
      input: RemoveDashboardLabels!
   ): Dashboard

The required input argument accepts a RemoveDashboardLabels object. Provide the view or repository name, the dashboard ID, and the list of labels to remove. See the Input Parameters section for details.

The mutation returns a Dashboard object on success, or null with errors on failure. Request the labels field in the returned object to verify the dashboard's remaining labels. See the Returned Values section for the full list of available fields.

Hide Query Example

Show Dashboard Identifiers Query

Example

Raw
graphql
mutation {
  removeDashboardLabels(
    input: { 
      viewName: "humio",
      id: "sales-dasher",
      labels: [ "sales-assistants" ]
    }
  )
  {displayName, labels }
}
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 {
  removeDashboardLabels(
    input: { 
      viewName: \"humio\",
      id: \"sales-dasher\",
      labels: [ \"sales-assistants\" ]
    }
  )
  {displayName, labels }
}"
}
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 {
  removeDashboardLabels(
    input: { 
      viewName: \"humio\",
      id: \"sales-dasher\",
      labels: [ \"sales-assistants\" ]
    }
  )
  {displayName, labels }
}"
}
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 { ^
  removeDashboardLabels( ^
    input: {  ^
      viewName: \"humio\", ^
      id: \"sales-dasher\", ^
      labels: [ \"sales-assistants\" ] ^
    } ^
  ) ^
  {displayName, labels } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  removeDashboardLabels(
    input: { 
      viewName: \"humio\",
      id: \"sales-dasher\",
      labels: [ \"sales-assistants\" ]
    }
  )
  {displayName, labels }
}"
}'
    "$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 {
  removeDashboardLabels(
    input: { 
      viewName: \"humio\",
      id: \"sales-dasher\",
      labels: [ \"sales-assistants\" ]
    }
  )
  {displayName, labels }
}";
$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 {
  removeDashboardLabels(
    input: { 
      viewName: \"humio\",
      id: \"sales-dasher\",
      labels: [ \"sales-assistants\" ]
    }
  )
  {displayName, labels }
}"
}'''

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 {
  removeDashboardLabels(
    input: { 
      viewName: \"humio\",
      id: \"sales-dasher\",
      labels: [ \"sales-assistants\" ]
    }
  )
  {displayName, labels }
}"
}
);


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": {
    "removeDashboardLabels": {
      "displayName": "Sales Dashboard",
      "labels": [ "sales_dept",
                "admin-focus" ]
    }
  }
}

Input Parameters

The RemoveDashboardLabels input type requires three fields: the view or repository name (viewName), the unique identifier of the dashboard (id), and the list of labels to remove (labels). The viewName field accepts either a repository name or a view name; views are read-only abstractions over one or more repositories and are valid scopes for this mutation. The id field is the system-generated unique identifier for the dashboard, not its display name. Use the repository() query to retrieve dashboard IDs, as shown in the Syntax section. Each value in labels must match an existing label on the dashboard exactly; labels that do not match are ignored.

Returned Values

The mutation returns the updated Dashboard object after a successful label removal. Request the labels field to confirm the dashboard's remaining labels and determine whether further additions or removals are needed.