Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
jjb427
Partner - Contributor III
Partner - Contributor III

Qlik Engine API authentication failure - UnknownUser

Hello, I'm trying to use the Engine API to extract information about apps in my Qlik Sense environment, but I'm getting the following error: `Access to the app is denied: UnknownUser`

I'm using the same header as I successfully use for the QRS API ('X-Qlik-User: UserDirectory=<directory>;UserId=<user>'), and I have verified that the user has access to the app I'm trying to fetch details from.

 

This is the relevant code:

load_app = json.dumps({
"method": "OpenDoc",
"params": {
"qDocName": app_id
},
"handle": -1,
"id": 1,
"jsonrpc": "2.0"
})
 
get_objects = json.dumps({
"method": "GetObjects",
"handle": 1,
"params": {},
"id": 2,
"jsonrpc": "2.0"
})
 
ws.send(load_app)
ws.send(get_objects)
 
The error is occurring at the second execution statement (ws.send(get_objects)) so presumably loading the app is successful.
Labels (2)
3 Replies
Øystein_Kolsrud
Employee
Employee

It might be that you simply need to wait for the first request to successfully complete before sending the second request. If you send the second one too early, then the handle you use in that call won't be associated with anything yet.

jjb427
Partner - Contributor III
Partner - Contributor III
Author

@Øystein_Kolsrud it seems I was wrong above about it occurring during execution of the second request, I've temporarily removed that request from my code and the UnknownUser error is still occurring, so it seems it is not able to load the app

Øystein_Kolsrud
Employee
Employee

Hard to say what is wrong in your particular case. Getting the authentication part right can be kind of tricky. Have you looked at at this page?

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

It gives some instructions regarding setting up connections to the engine. In particular there is "Example 1: Connect directly to Qlik Engine JSON API using certificates" which shows you how to do this in JavaScript.