API Stability Long-Term

The installPackageFromZip() GraphQL mutation field may be used to install a package from file provided in multipart or form-data (i.e, name=file) in a specific view.

For more information on packages, see the Packages documentation page.

Syntax

Below is the syntax for the installPackageFromZip() mutation field:

graphql
installPackageFromZip(
     viewName: string!, 
     overwrite: boolean,
     queryOwnershipType: QueryOwnershipType
   ): InstallPackageFromZipResult!

Example

To do this, you must specify the name of the file on the command-line using curl you will need to specify a multi-part form entry, one part consisting of the mutation and the other the name of the file of the package to bee installed. For example:

shell
$ curl --location 'https://$YOUR_LOGSCALE_URL/graphql' \
--header 'Authorization: Bearer XXXXXXXXXXXXXX' \
--header 'accept: application/json, multipart/mixed' \
--form 'file=@"package.zip"' \
--form 'json="{\"query\":\"mutation {installPackageFromZip(viewName: \\\"Package_Testing\\\",overwrite: true) {wasSuccessful}}\"}";type=application/json'

When completed successfully you will get the success message back:

json
{
  "data": {
    "installPackageFromZip": {
      "wasSuccessful": true
    }
  }
}

Given Datatypes

For QueryOwnershipType, there are several options. Below is a list of them. Ownership relates to the queries run by the triggers (e.g. alerts and scheduled searches) that are installed as part of this package. If the value is User, ownership will be based on the calling user.

Table: QueryOwnershipType

ParameterTypeRequiredDefaultStabilityDescription
Some arguments may be required, as indicated in the Required column. For some fields, this column indicates that a result will always be returned for this column.
Table last updated: Sep 16, 2024
Organizationboolean  Long-TermQueries run on behalf of the organization.
Userboolean  Long-TermQueries run on behalf of the user.

Returned Datatypes

The returned datatype InstallPackageFromZipResult has one parameter. Below is a description of it:

Table: InstallPackageFromZipResult

ParameterTypeRequiredDefaultStabilityDescription
Some arguments may be required, as indicated in the Required column. For some fields, this column indicates that a result will always be returned for this column.
Table last updated: Sep 25, 2024
packagebooleanyes Long-TermWhether package was installed successfully.