Skip to main content
Announcements
July 15, NEW Customer Portal: Initial launch will improve how you submit Support Cases. READ MORE

How to delete spaces in Qlik Cloud Services using Qlik Application Automation

No ratings
cancel
Showing results for 
Search instead for 
Did you mean: 
J_Lindberg
Support
Support

How to delete spaces in Qlik Cloud Services using Qlik Application Automation

Last Update:

Nov 9, 2023 9:06:25 AM

Updated By:

DaveChannon

Created date:

Nov 10, 2023 5:18:11 AM

Attachments

This article explains how you can Delete spaces in Qlik Cloud Services using Qlik Application Automation. Multiple spaces can be deleted during one run. As when deleting a space via the user interface, this will also delete any apps, data files or other content within the space(s) using the relevant blocks for those content types.

For information about spaces in Qlik Cloud, see Navigating Spaces.

This automation is not designed to be triggered using a webhook or on a schedule. It has been designed with manual user input in mind and requires multiple confirmations.

If you use your own automation to delete spaces, know that deleting a space via the space blocks will not delete the content in the space, and will instead result in that content being orphaned in the tenant. Leverage the examples in this automation to first delete content from spaces prior to deleting the space.

Once deleted, spaces, apps, or data files cannot be recovered.

Content:

 

Prerequisites

This automation assumes you have a TenantAdmin role.

Overview

The automation is divided into five sections: 

  1. Start 
  2. Confirm selected spaces
  3. Delete apps
  4. Delete data files
  5. Delete spaces
  6. Finalize

 

Start

The Start section retrieves all available spaces and prompts you to select what spaces you want to delete.

Overview:

Delete Spaces Automation Overview.png

Setting it up:

  1. The List Spaces block retrieves all spaces on the tenant that you have access to.
  2. The Filter List block filters spaces that you have the delete permission to.

    This is achieved using a condition configured such as this:

    Condition
    If meta.actions
    list contains
    delete

    List Spaces.png

  3. The Transform List block reformats the space list to improve readability in the input block (id, name and type are kept).
  4. The Inputs block adds a prompt for selecting the spaces to delete.

    Multi-selection is allowed:

    Which space would you like to delete.png

  5. A Go To Label block moves to the next section of the automation.
     
    Before the Go To Label block can be configured, the targeted Label must already exist. This is done in the next section.

 

Confirm selected spaces

This section provides the possibility to review the selected spaces before deleting them.

Overview:

Confirm Selected Spaces Part One.png

Confirm Selected Spaces Part Two.png

Setting it up:

  1. The Label block is named Confirm Selected Spaces and this must also be configured in the Go To Label block from the previous section.
  2. A Loop block loops over selected spaces.
  3. Within the loop, a List Apps block retrieves apps in the space. The output of this block is stored in the variable appList which is used for reviewing what apps exist within the spaces that will be deleted.
  4. To retrieve the connectionId for data files in this space, a Raw API Request block is used. The path in the block is configured to use data-files/connections and the HTTP method is set to GET. A query parameter is also added where the key is set to spaceId and the value is set to {$.loop.item}.
  5. The connectionId retrieved in the previous step is used to retrieve data files in this space using the List Data Files block. The output of this block is stored in the variable dataFileList which is used to review the data files that exist within the spaces flagged for deletion.
  6. After the loop, an Output block displays which spaces will be deleted.
  7. We use an Inputs block to allow user confirmation before deleting apps, data files and other content within the selected spaces:

    Spaces to be deleted.png

  8. A Go To Label block moves to the next section of the automation.

    Before the Go To Label block can be configured, the targeted Label must already exist. This is done in the next section.

 

Delete apps

Once deleted, spaces, apps, or data files cannot be recovered.

This section deletes all existing apps inside the space(s). A space cannot be removed before all apps are deleted.

Overview:

Delete Apps Step.png

Setting it up:

  1. The numeric variable iter tracks how many apps are deleted. 
  2. A Loop block loops over the items in the variable appList.
  3. The variable iter is increased by 1 per loop iteration.
  4. The block Get App Information retrieves the app name based on the app id. 
  5. The app is deleted using the block Delete App.
  6. A deleted app status will be presented using the string variable message
  7. The delete apps status will be presented using an Output block:

    deleted app status.png

  8. The delete apps status will also be presented using the block Update Run Title:

    update run title.png

  9. A Go To Label moves on to the next section of the automation. 

    Before the Go To Label block can be configured, the targeted Label must already exist. This is done in the next section.

 

Delete data files

Once deleted, spaces, apps, or data files cannot be recovered.

This section deletes all data files within the selected space(s).

Overview:

Delete Data Files Step.png

Setting it up:

  1. The numeric variable iter tracks of how many data files are deleted. 
  2. A Loop block loops over the items in the variable dataFileList.
  3. The variable iter is increased by 1 per loop iteration.
  4. To retrieve the data file name for datafiles we use a Raw API Request block configured such as this:

    Path: data-files/{ $.loop3.item }

    HTTP Method: GET

    raw api request path and method.png

  5. The data file is deleted using the block Delete Data File.
  6. A deleted data file status will be presented using the string variable message
  7. The deleted data file status will be presented using an Output block:

    Deleted data files.png

  8. The delete data file status will also be presented using the block Update Run Title:

    Deleted ata files update run title block.png

  9. Finally, a Go To Label block moves on to the next section of the automation. 

    Before the Go To Label block can be configured, the targeted Label must already exist. This is done in the next section.

 

Delete spaces

Once deleted, spaces, apps, or data files cannot be recovered.

This section deletes all selected spaces. 

Overview:

Delete Spaces Step.png

Setting it up:

  1. The numeric variable iter tracks of how many spaces are deleted. 
  2. A Loop block loops over the selected spaces.
  3. The variable iter is increased by 1 per loop iteration.
  4. To retrieve the name of the space we use a Lookup Item In List block.
  5. The space is deleted using the block Delete Space.
  6. A deleted space status will be presented using the string variable message.
  7. The delete space status will be presented using an Output block

    deleted space.png

  8. The delete space status will also be presented using the block Update Run Title.

 

Finalize

This section wraps up the automation and updates the final status of the automation run. 

Overview:

Finalize the Automation.png

Setting it up:

  1. A summary of how many apps, data files and apps have been deleted is presented using the string variable message.
  2. The summary is presented using an Output block:

    summary of deleted items.png

  3. The summary is also returned using the block Update Run Title:

    Update Run Title summary.png

 

Running the Automation

  1. On run, choose which space to delete. Be careful not to select spaces you want to keep:

    Select what space to delete.png
  2. Once you have selected the space or spaces, you are prompted to confirm the deletion of apps, data files and other content that exists within this space or spaces. If you don't want to proceed you can stop the automation. If you want to proceed you need to click on the green confirmation button:

    Spaces to be deleted.png

 

Related Content

Navigating Spaces
Managing permissions in shared spaces 
Managing permissions in managed spaces 

 

Environment

Qlik Application Automation
Qlik Cloud

 

The information in this article is provided as-is and to be used at own discretion. Depending on tool(s) used, customization(s), and/or other factors ongoing support on the solution below may not be provided by Qlik Support.

Labels (2)
Version history
Last update:
‎2023-11-09 09:06 AM
Updated by: