Summary

The updatePackageFromRegistryV2() mutation updates an installed package to a newer version in a specific view or repository. Provide the target view name and the versioned package identifier in scope/name@version format — for example, humio/insights@0.0.14. The required conflictResolutions argument provides a list of resolutions for entity-level conflicts — for example, when an existing dashboard in the view shares a name with a dashboard in the updated package. The optional queryOwnershipType argument controls whether scheduled searches and saved queries instantiated from the package's templates are owned by the organization or by the installing user. To install a package for the first time, use installPackageFromRegistryV2(). To remove an installed package, use uninstallPackage().

Syntax

graphql
updatePackageFromRegistryV2(
      UpdatePackageFromRegistryInput: UpdatePackageFromRegistryInput!
   ): PackageUpdateResult!

The mutation takes a single required argument, UpdatePackageFromRegistryInput, an input object with three required fields — viewName, packageId, and conflictResolutions — and one optional field, queryOwnershipType. The packageId field accepts a VersionedPackageSpecifier scalar in scope/name@version format. The conflictResolutions field accepts a list of ConflictResolutionConfiguration objects that specify how to handle conflicts when an entity in the view shares a name with an entity in the updated package. Setting queryOwnershipType to Organization makes scheduled searches and saved queries from the package's templates visible to all users with access to the repository. Setting it to User assigns ownership to the installing user. If omitted, LogScale applies the system default.

Input parameters

The input type requires the name of the target view, the versioned package identifier, and a list of conflict resolutions. The packageId field accepts a VersionedPackageSpecifier scalar in scope/name@version format. The viewName field accepts a RepoOrViewName scalar identifying the repository or view containing the installed package. The conflictResolutions field accepts a list of ConflictResolutionConfiguration objects. Each object specifies an entity type, entity name, and resolution strategy for a naming conflict between an existing entity in the view and an entity in the updated package. The optional queryOwnershipType field, available since version 1.100, determines ownership of scheduled searches and saved queries created from the package's templates. The following table lists the parameters:

Table: UpdatePackageFromRegistryInput Input Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
conflictResolutionsConflictResolutionConfigurationyes Long-Term A list of resolutions to any conflicts encountered. See ConflictResolutionConfiguration.
packageIdVersionedPackageSpecifieryes Long-Term The unique identifier for the package. VersionedPackageSpecifier is a scalar.
queryOwnershipTypeQueryOwnershipType  Long-Term Ownership of the query run by this filter alert. If value is User, ownership will be based on the runAsUserId field. See QueryOwnershipType.
viewNameRepoOrViewNameyes Long-Term The name of the view related to the package. RepoOrViewName is a scalar.

Example

Raw
graphql
mutation {
  updatePackageFromRegistryV2(
     UpdatePackageFromRegistryInput: 
      {viewName: "humio",
       packageId: "humio/insights@0.0.14",
       conflictResolutions: [ { entityType: Dashboard, 
                                entityName: "Errors",
                                conflictResolution: Ours },
                              { entityType: Dashboard, 
                                entityName: "Hosts",
                                conflictResolution: Ours }],
       queryOwnershipType: Organization
      }
  )
  { package { 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 {
  updatePackageFromRegistryV2(
     UpdatePackageFromRegistryInput: 
      {viewName: \"humio\",
       packageId: \"humio/insights@0.0.14\",
       conflictResolutions: [ { entityType: Dashboard, 
                                entityName: \"Errors\",
                                conflictResolution: Ours },
                              { entityType: Dashboard, 
                                entityName: \"Hosts\",
                                conflictResolution: Ours }],
       queryOwnershipType: Organization
      }
  )
  { package { 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 {
  updatePackageFromRegistryV2(
     UpdatePackageFromRegistryInput: 
      {viewName: \"humio\",
       packageId: \"humio/insights@0.0.14\",
       conflictResolutions: [ { entityType: Dashboard, 
                                entityName: \"Errors\",
                                conflictResolution: Ours },
                              { entityType: Dashboard, 
                                entityName: \"Hosts\",
                                conflictResolution: Ours }],
       queryOwnershipType: Organization
      }
  )
  { package { 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 { ^
  updatePackageFromRegistryV2( ^
     UpdatePackageFromRegistryInput:  ^
      {viewName: \"humio\", ^
       packageId: \"humio/insights@0.0.14\", ^
       conflictResolutions: [ { entityType: Dashboard,  ^
                                entityName: \"Errors\", ^
                                conflictResolution: Ours }, ^
                              { entityType: Dashboard,  ^
                                entityName: \"Hosts\", ^
                                conflictResolution: Ours }], ^
       queryOwnershipType: Organization ^
      } ^
  ) ^
  { package { id } } ^
}" ^
} '
Windows Powershell and curl
powershell
curl.exe -X POST 
    -H "Authorization: Bearer $TOKEN"
    -H "Content-Type: application/json"
    -d '{"query" : "mutation {
  updatePackageFromRegistryV2(
     UpdatePackageFromRegistryInput: 
      {viewName: \"humio\",
       packageId: \"humio/insights@0.0.14\",
       conflictResolutions: [ { entityType: Dashboard, 
                                entityName: \"Errors\",
                                conflictResolution: Ours },
                              { entityType: Dashboard, 
                                entityName: \"Hosts\",
                                conflictResolution: Ours }],
       queryOwnershipType: Organization
      }
  )
  { package { 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 {
  updatePackageFromRegistryV2(
     UpdatePackageFromRegistryInput: 
      {viewName: \"humio\",
       packageId: \"humio/insights@0.0.14\",
       conflictResolutions: [ { entityType: Dashboard, 
                                entityName: \"Errors\",
                                conflictResolution: Ours },
                              { entityType: Dashboard, 
                                entityName: \"Hosts\",
                                conflictResolution: Ours }],
       queryOwnershipType: Organization
      }
  )
  { package { 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 {
  updatePackageFromRegistryV2(
     UpdatePackageFromRegistryInput: 
      {viewName: \"humio\",
       packageId: \"humio/insights@0.0.14\",
       conflictResolutions: [ { entityType: Dashboard, 
                                entityName: \"Errors\",
                                conflictResolution: Ours },
                              { entityType: Dashboard, 
                                entityName: \"Hosts\",
                                conflictResolution: Ours }],
       queryOwnershipType: Organization
      }
  )
  { package { 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 {
  updatePackageFromRegistryV2(
     UpdatePackageFromRegistryInput: 
      {viewName: \"humio\",
       packageId: \"humio/insights@0.0.14\",
       conflictResolutions: [ { entityType: Dashboard, 
                                entityName: \"Errors\",
                                conflictResolution: Ours },
                              { entityType: Dashboard, 
                                entityName: \"Hosts\",
                                conflictResolution: Ours }],
       queryOwnershipType: Organization
      }
  )
  { package { 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": {
    "updatePackageFromRegistryV2": {
      "package": {
        "id": "humio/insights@0.0.14"
      }
    }
  }
}

Returned values

The mutation returns a non-nullable PackageUpdateResult! object. The result provides access to the updated package through its package field, which returns the full Package2 type. Request package.id to confirm the updated package identifier. The Package2 type exposes all template categories bundled in the package — including dashboards, parsers, alerts, aggregate alerts, filter alerts, scheduled searches, saved queries, actions, and lookup files — along with metadata fields such as name, version, description, author, minHumioVersion, and licenseUrl. The following table links to the sub-parameters for the returned type:

Table: PackageUpdateResult Datatype

ParameterTypeRequiredDefaultStabilityAvailabilityDescription
packagePackage2yes Long-Term The package that was updated. See Package2.