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
   ): BooleanResultType!

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
    }
  }
}

Returned Datatypes

The returned datatype BooleanResultType has its own parameters. Below is a list of them along with their datatypes and a description of each:

Table: BooleanResultType

ParameterTypeRequiredDefaultDescription
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.
resultsbooleanyes Whether the mutation was performed.