Summary

The fleetManagementSetUseLegacyQueries() mutation enables or disables legacy query support for the LogScale fleet management system. Legacy queries use an older communication protocol that some fleet management agent versions require. Set useLegacyQueries to true to permit legacy queries or false to require the current protocol. To check the current setting before changing it, use the fleetManagementGetUseLegacyQueries() query.

API Stability Short-Term

Syntax

graphql
fleetManagementSetUseLegacyQueries(
      useLegacyQueries: Boolean
   ): Boolean!

The useLegacyQueries argument is optional; the type is nullable Boolean. Pass true to enable legacy query support or false to disable it. The mutation returns a non-null Boolean! reflecting the updated setting: true if legacy queries are now enabled, false if disabled.

Example

Raw
graphql
mutation {
  fleetManagementSetUseLegacyQueries(
    useLegacyQueries: False
  )
}
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 {
  fleetManagementSetUseLegacyQueries(
    useLegacyQueries: False
  )
}"
}
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 {
  fleetManagementSetUseLegacyQueries(
    useLegacyQueries: False
  )
}"
}
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 { ^
  fleetManagementSetUseLegacyQueries( ^
    useLegacyQueries: False ^
  ) ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  fleetManagementSetUseLegacyQueries(
    useLegacyQueries: False
  )
}"
}'
    "$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 {
  fleetManagementSetUseLegacyQueries(
    useLegacyQueries: False
  )
}";
$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 {
  fleetManagementSetUseLegacyQueries(
    useLegacyQueries: False
  )
}"
}'''

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 {
  fleetManagementSetUseLegacyQueries(
    useLegacyQueries: False
  )
}"
}
);


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": {
    "fleetManagementSetUseLegacyQueries": "true"
  }
}

Input Parameters

This mutation accepts one optional Boolean argument to control legacy query support.

Table: Input Parameters and Datatypes

Parameter Type Required Default Description
This table contains all input parameters for this mutation.
useLegacyQueries Boolean     Set to true to enable legacy query support for fleet management agents that require the older communication protocol. Set to false to disable it and require the current protocol.

Returned Values

The mutation returns a non-null Boolean! reflecting the updated state of the legacy query setting. true indicates that legacy queries are now enabled; false indicates that legacy queries are now disabled.