Summary

The updateScheduledReportFromTemplate() mutation updates a scheduled report using a complete YAML template definition. Supply the report ID, the view name, and a full YAML template that describes the updated configuration. Use this mutation when you manage scheduled report definitions as code or when the changes you want to apply are easier to express as a complete YAML definition than as discrete field values. To create a new scheduled report from a YAML template, use createScheduledReportFromTemplate() instead.

Syntax

graphql
updateScheduledReportFromTemplate(
      input: UpdateScheduledReportFromTemplateInput!
   ): ScheduledReport!

The mutation accepts a single required input argument of type UpdateScheduledReportFromTemplateInput!. The input requires three fields: the view name, the report ID, and the YAML template. The mutation returns a non-null ScheduledReport object representing the updated report.

Input parameters

The input argument requires three fields. viewName identifies the repository or view that owns the scheduled report. reportId is the unique identifier of the report to update; use the scheduledReport() query to obtain it. yamlTemplate is a complete YAML representation of the updated report configuration — the template replaces the definition in full, not partially.

Table: UpdateScheduledReportFromTemplateInput Input Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
reportIdStringyes   The id of the scheduled report to update.
viewNameStringyes   Name of the view of the scheduled report.
yamlTemplateYAMLyes   The YAML template for the scheduled report.

Example

Raw
graphql
mutation {
  updateScheduledReportFromTemplate(input:
        {viewName: "our_view", 
         reportId: "abc123", 
         yamlTemplate: "name: Sales\n ... " } )
  { dashboard { name }, 
    schedule { cronExpression }, 
    enabled }
}
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 {
  updateScheduledReportFromTemplate(input:
        {viewName: \"our_view\", 
         reportId: \"abc123\", 
         yamlTemplate: \"name: Sales\n ... \" } )
  { dashboard { name }, 
    schedule { cronExpression }, 
    enabled }
}"
}
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 {
  updateScheduledReportFromTemplate(input:
        {viewName: \"our_view\", 
         reportId: \"abc123\", 
         yamlTemplate: \"name: Sales\n ... \" } )
  { dashboard { name }, 
    schedule { cronExpression }, 
    enabled }
}"
}
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 { ^
  updateScheduledReportFromTemplate(input: ^
        {viewName: \"our_view\",  ^
         reportId: \"abc123\",  ^
         yamlTemplate: \"name: Sales\n ... \" } ) ^
  { dashboard { name },  ^
    schedule { cronExpression },  ^
    enabled } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  updateScheduledReportFromTemplate(input:
        {viewName: \"our_view\", 
         reportId: \"abc123\", 
         yamlTemplate: \"name: Sales\n ... \" } )
  { dashboard { name }, 
    schedule { cronExpression }, 
    enabled }
}"
}'
    "$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 {
  updateScheduledReportFromTemplate(input:
        {viewName: \"our_view\", 
         reportId: \"abc123\", 
         yamlTemplate: \"name: Sales\n ... \" } )
  { dashboard { name }, 
    schedule { cronExpression }, 
    enabled }
}";
$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 {
  updateScheduledReportFromTemplate(input:
        {viewName: \"our_view\", 
         reportId: \"abc123\", 
         yamlTemplate: \"name: Sales\n ... \" } )
  { dashboard { name }, 
    schedule { cronExpression }, 
    enabled }
}"
}'''

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 {
  updateScheduledReportFromTemplate(input:
        {viewName: \"our_view\", 
         reportId: \"abc123\", 
         yamlTemplate: \"name: Sales\n ... \" } )
  { dashboard { name }, 
    schedule { cronExpression }, 
    enabled }
}"
}
);


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": {
    "updateScheduledReportFromTemplate": {
      "dashboard": { "name", "sales" }
      "schedule": { "cronExpression": "15 1 * * 0" },
      "enabled": "true"
    }
  }
}

Returned values

The mutation returns a ScheduledReport object representing the report after the update is applied. The object includes the report name, the associated dashboard, the delivery schedule, and the status of the most recent execution.

Table: ScheduledReport Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
allowedActionsAssetActionyes Short-Term Allowed asset actions
createdByUser   deprecated in 1.306User who created the report.
createdInfoAssetCommitMetadata  Long-Termadded in 1.253Metadata related to the creation of the scheduled report
creationDateStringyes  deprecated in 1.306Date when the report was created.
dashboardDashboard  Long-Term The dashboard the report was created for.
dashboardIdStringyes Long-Term The id of the dashboard the report was created for.
descriptionStringyes Long-Term Description of the scheduled report.
enabledBooleanyes Long-Term Flag indicating whether the scheduled report is enabled.
idStringyes Long-Term Id of the scheduled report.
isPasswordDefinedBooleanyes Long-Term Flag indicating whether a password is defined for the report.
labelsStringyes Long-Term Labels attached to the scheduled report.
lastExecutionErrorsStringyes Long-Term Last errors encountered while generating the scheduled report.
lastExecutionWarningsStringyes Long-Term Last warnings encountered while generating the scheduled report.
layoutScheduledReportLayoutyes Long-Term Layout of the scheduled report.
nameStringyes Long-Term Name of the scheduled report.
packagePackageInstallation  Long-Term  
packageIdVersionedPackageSpecifier  Long-Term  
parametersParameterValueyes Long-Term List of parameter value configurations.
recipientsStringyes Long-Term List of recipients who should receive an email with the generated report.
resourceStringyes Short-Term The resource identifier for this scheduled report.
scheduleScheduleyes Long-Term The schedule to run the report by. This can be either a cron schedule or an interval schedule.
statusStringyes Long-Term Status of the latest report execution.
timeIntervalStartString  Long-Term Start of the relative time interval for the dashboard.
timeOfLastExecutionStartLong  Long-Term Unix timestamp for when the last execution was sent to the render service for generation.
timeOfLastReportExecutionLong  Long-Term Unix timestamp for the completion of the last report execution. This does not indicate whether it was successful.
timeOfNextPlannedReportExecutionLong  Long-Term Unix timestamp for the next planned report execution.
yamlTemplateYAMLyes Preview A YAML formatted string that describes the scheduled report template.