# Apps

## Table of Contents

| Method | Path | Description |
|--------|------|-------------|
| `POST` | [`/api/analytics/apps/{appId}/actions/restore`](#post-apianalyticsappsappidactionsrestore) | Restores a soft-deleted Qlik Cloud Analytics application to the same space with the same app ID, retaining the properties it had at the time of deletion. |

## API Reference

### POST /api/analytics/apps/{appId}/actions/restore

Restores a soft-deleted Qlik Cloud Analytics application to the same space with the same app ID, retaining the properties it had at the time of deletion.
This operation is available to the app owner and Tenant Admins. The app owner can restore the app only if the original space still exists and they still have delete permission in the space; otherwise, a 403 Forbidden error is returned.
Associated resources such as data alerts, subscriptions, collections, notes, and tags are deleted when the app is deleted and cannot be restored.

- **Rate Limit:** Tier 2 (100 requests per minute)

#### Path Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `appId` | string | Yes | Identifier of the app. |

#### Responses

##### 200

OK

**Content-Type:** `application/json`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `create` | object[] | No | Object create privileges. Hints to the client what type of objects the user is allowed to create. |
| `attributes` | object | No | Application attributes. |
| `privileges` | string[] | No | Application privileges. Hints to the client what actions the user is allowed to perform. Could be any of: * read * create * update * delete * reload * import * publish * duplicate * export * exportdata * change_owner * change_space |

<details>
<summary>Properties of `create`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `resource` | string | No | Type of resource. For example, sheet, story, bookmark, etc. |
| `canCreate` | boolean | No | Is set to true if the user has privileges to create the resource. |

</details>

<details>
<summary>Properties of `attributes`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | string | No | The App ID. |
| `name` | string | No | App name. |
| `state` | string | No | Promotion state of the app. Promotion state of an app. One of: * EMPTY * PROMOTED * DISTRIBUTED Enum: "EMPTY", "PROMOTED", "DISTRIBUTED" |
| `usage` | string | No | Indicates the use for the app.  One of: * ANALYTICS * DATA_PREPARATION * DATAFLOW_PREP * SINGLE_TABLE_PREP * DIRECT_QUERY_MODE Enum: "ANALYTICS", "DATA_PREPARATION", "DATAFLOW_PREP", "SINGLE_TABLE_PREP", "DIRECT_QUERY_MODE" |
| `ownerId` | string | No | Identifier of the app owner. |
| `spaceId` | string | No | The ID of the app's space. |
| `createdAt` | string | No | The date and time when the app was created. |
| `updatedAt` | string | No | The date and time when the app was modified. |
| `promotedAt` | string | No | The date and time when the app was promoted, empty if not promoted. Use to determine if an app is promoted in Qlik Cloud. |
| `reloadedAt` | string | No | Date and time of the last reload of the app. |
| `description` | string | No | App description. |
| `originAppId` | string | No | The Origin App ID for promoted apps. |
| `resourceType` | string | No | App resource type. |
| `hasSectionAccess` | boolean | No | If set to true, the app has section access configured. |

</details>

##### 400

Bad request

**Content-Type:** `application/json`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `errors` | object[] | No | Array of all errors that occurred during the request. |

<details>
<summary>Properties of `errors`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | Yes | A unique code for the error. |
| `title` | string | Yes | A human-readable description of the error. |
| `detail` | string | No | Additional information about the error. |

</details>

##### 401

Unauthorized

**Content-Type:** `application/json`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `errors` | object[] | No | Array of all errors that occurred during the request. |

<details>
<summary>Properties of `errors`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | Yes | A unique code for the error. |
| `title` | string | Yes | A human-readable description of the error. |
| `detail` | string | No | Additional information about the error. |

</details>

##### 403

Forbidden

**Content-Type:** `application/json`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `errors` | object[] | No | Array of all errors that occurred during the request. |

<details>
<summary>Properties of `errors`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | Yes | A unique code for the error. |
| `title` | string | Yes | A human-readable description of the error. |
| `detail` | string | No | Additional information about the error. |

</details>

##### 404

Not Found

**Content-Type:** `application/json`

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `errors` | object[] | No | Array of all errors that occurred during the request. |

<details>
<summary>Properties of `errors`</summary>

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | string | Yes | A unique code for the error. |
| `title` | string | Yes | A human-readable description of the error. |
| `detail` | string | No | Additional information about the error. |

</details>

#### Examples

**JavaScript:**

```javascript
// qlik-api has not implemented support for `POST /api/analytics/apps/{appId}/actions/restore` yet.
// In the meantime, you can use fetch like this:

const response = await fetch(
  '/api/analytics/apps/{appId}/actions/restore',
  {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
  },
)

```

**Qlik CLI:**

```bash
# qlik-cli has not implemented support for POST /api/analytics/apps/{appId}/actions/restore yet.
```

**cURL:**

```bash
curl "https://your-tenant.us.qlikcloud.com/api/analytics/apps/{appId}/actions/restore" \
-X POST \
-H "Authorization: Bearer <access_token>"
```

**Example Response:**

```json
{
  "create": [
    {
      "resource": "string",
      "canCreate": true
    }
  ],
  "attributes": {
    "id": "string",
    "name": "string",
    "state": "string",
    "usage": "string",
    "ownerId": "string",
    "spaceId": "string",
    "createdAt": "2019-01-01T00:00:00.000Z",
    "updatedAt": "2019-01-01T00:00:00.000Z",
    "promotedAt": "2019-01-01T00:00:00.000Z",
    "reloadedAt": "2019-01-01T00:00:00.000Z",
    "description": "string",
    "originAppId": "string",
    "resourceType": "string",
    "hasSectionAccess": true
  },
  "privileges": [
    "string"
  ]
}
```

---
