Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Manoj_Prabu
Partner - Creator
Partner - Creator

How to Enable Insight Advisor in app using API in Qlik sense?

Hi Community,

I'm trying to Enable the Insight Advisor in app using API. Is it possible? If so please share how.

This is for Enabling manually => Enable Apps for Insight Advisor 

I need to Enable using API.

Thanks

1 Solution

Accepted Solutions
Damien_Villaret
Support
Support

Hello @Manoj_Prabu 

Yes, this is possible using the Engine API.

Actually, enabling the Insight Advisor chat is just a matter of creating a variable called "crossAppsSearchEnabled" inside the app and setting the value to 1.

So a rough workflow to have it enabled would be:

1. Open app

{
	"method": "OpenDoc",
	"handle": -1,
	"params": [
		"5c7b09cb-4b8e-4c37-af79-48c0fa4a3da8"
	],
	"id": 2
}

2. Create variable

{"delta":true,"handle":1,"method":"CreateVariableEx","params":[{"qInfo":{"qType":"variable"},"qName":"crossAppsSearchEnabled","qDefinition":"1","qComment":"","tags":[]}],"id":36,"jsonrpc":"2.0"}

3. Get Variable by name, you will get back the id a handle to use to set the properties in step 4

{"handle": 1,"method": "GetVariableByName","params": ["crossAppsSearchEnabled"]}

Response example (pay attention to "qHandle" and genericObjectId:

{
	"jsonrpc": "2.0",
	"id": 4,
	"delta": true,
	"result": {
		"qReturn": {
			"qType": "GenericVariable",
			"qHandle": 2,
			"qGenericType": "variable",
			"qGenericId": "08d8cef2-b1e1-418f-acb8-5e111b78feb5"
		}
	}
}

4. Set variable properties

{
	"handle": 2,
	"method": "SetProperties",
	"params": [
		{
			"qInfo": {
				"qId": "08d8cef2-b1e1-418f-acb8-5e111b78feb5",
				"qType": "variable"
			},
			"qMetaDef": {},
			"qName": "crossAppsSearchEnabled",
			"qComment": "",
			"qNumberPresentation": {
				"qType": "U",
				"qnDec": 10,
				"qUseThou": 0,
				"qFmt": "",
				"qDec": "",
				"qThou": ""
			},
			"qIncludeInBookmark": false,
			"qDefinition": "1",
			"tags": []
		}
	],
	"id": 6,
	"jsonrpc": "2.0"
}

5. Reload the app

{
	"handle": 1,
	"method": "DoReloadEx",
	"params": {
		"qParams": {
			"qMode": 0,
			"qPartial": false,
			"qDebug": false,
			"qReloadId": ""
		}
	}
}

6. Save the app

{
	"handle": 1,
	"method": "DoSave",
	"params": {
		"qFileName": ""
	}
}

Done.

 

Here is some documentation on how to use the Engine API, this is a JSON-RPC websocket API

https://help.qlik.com/en-US/sense-developer/February2021/Subsystems/EngineAPI/Content/Sense_EngineAP...

If the issue is solved please mark the answer with Accept as Solution.

View solution in original post

2 Replies
Damien_Villaret
Support
Support

Hello @Manoj_Prabu 

Yes, this is possible using the Engine API.

Actually, enabling the Insight Advisor chat is just a matter of creating a variable called "crossAppsSearchEnabled" inside the app and setting the value to 1.

So a rough workflow to have it enabled would be:

1. Open app

{
	"method": "OpenDoc",
	"handle": -1,
	"params": [
		"5c7b09cb-4b8e-4c37-af79-48c0fa4a3da8"
	],
	"id": 2
}

2. Create variable

{"delta":true,"handle":1,"method":"CreateVariableEx","params":[{"qInfo":{"qType":"variable"},"qName":"crossAppsSearchEnabled","qDefinition":"1","qComment":"","tags":[]}],"id":36,"jsonrpc":"2.0"}

3. Get Variable by name, you will get back the id a handle to use to set the properties in step 4

{"handle": 1,"method": "GetVariableByName","params": ["crossAppsSearchEnabled"]}

Response example (pay attention to "qHandle" and genericObjectId:

{
	"jsonrpc": "2.0",
	"id": 4,
	"delta": true,
	"result": {
		"qReturn": {
			"qType": "GenericVariable",
			"qHandle": 2,
			"qGenericType": "variable",
			"qGenericId": "08d8cef2-b1e1-418f-acb8-5e111b78feb5"
		}
	}
}

4. Set variable properties

{
	"handle": 2,
	"method": "SetProperties",
	"params": [
		{
			"qInfo": {
				"qId": "08d8cef2-b1e1-418f-acb8-5e111b78feb5",
				"qType": "variable"
			},
			"qMetaDef": {},
			"qName": "crossAppsSearchEnabled",
			"qComment": "",
			"qNumberPresentation": {
				"qType": "U",
				"qnDec": 10,
				"qUseThou": 0,
				"qFmt": "",
				"qDec": "",
				"qThou": ""
			},
			"qIncludeInBookmark": false,
			"qDefinition": "1",
			"tags": []
		}
	],
	"id": 6,
	"jsonrpc": "2.0"
}

5. Reload the app

{
	"handle": 1,
	"method": "DoReloadEx",
	"params": {
		"qParams": {
			"qMode": 0,
			"qPartial": false,
			"qDebug": false,
			"qReloadId": ""
		}
	}
}

6. Save the app

{
	"handle": 1,
	"method": "DoSave",
	"params": {
		"qFileName": ""
	}
}

Done.

 

Here is some documentation on how to use the Engine API, this is a JSON-RPC websocket API

https://help.qlik.com/en-US/sense-developer/February2021/Subsystems/EngineAPI/Content/Sense_EngineAP...

If the issue is solved please mark the answer with Accept as Solution.
Manoj_Prabu
Partner - Creator
Partner - Creator
Author

It works. Thanks @Damien_Villaret