Qlik Community

Ask a Question

Integration, Extension & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Announcements
Join us for a live Q&A! September 21, 10 AM ET - Onboarding Fast in Qlik Sense SaaS! REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
mountaindude
Luminary Alumni
Luminary Alumni

How can I get the ID of a reload task created using the QRS app/reload API?

Edit:

Turns out it can't be done using the /app/{id}/reload endpoint. It returns a 204 upon (no content) upon success, meaning that the body has, well, no content. 

The solution would be to first create a new reload task using the POST /reloadtask endpoint. Should work just fine, but is also more involved as you need to pass in more info. Not as convenient as the first endpoint thus, but will give the desired result.

 



I am using QSEoW and using the QRS API to kick off app reloads. 
The post /app/{id}/reload endpoint (docs here) is easy to use, especially when you have an app that you just want to reload, without having to care about reload tasks etc. 

The thing about that endpoint is that when its called, it will behind the scenes (if needed) create a new reload task called "Manually triggered reload of <app name>". If that task already exists it will not be created again.

I.e. the same behaviour that's available in the QMC's app list via the "Reload now" command.

All good so far, the challenge comes when you need to know more about that behind-the-scenes, auto-created reload task. Specifically, what is its ID? If there is a way to get hold of that new task's ID, any other data can be pulled from the APIs. 
But here's the thing: That ID is not returned from the API call, it seems.

 

Some more details. Let's say we make this API call:

 

 

 

# Reload app
curl -X "POST" "https://<sense-server-url>:4242/qrs/app/70037700-9400-453f-bebc-845f8a543294/reload?Xrfkey=abcdefghijklmnop" \
-H 'x-Qlik-Xrfkey: abcdefghijklmnop' \
-H 'X-Qlik-User: UserDirectory=Internal; UserId=sa_repository'

 

 

 

 

This will kick off a reload of the app with ID 70037700-9400-453f-bebc-845f8a543294, returning this info to the caller: 

 

 

 

POST /qrs/app/70037700-9400-453f-bebc-845f8a543294/reload?Xrfkey=abcdefghijklmnop HTTP/1.1
x-Qlik-Xrfkey: abcdefghijklmnop
X-Qlik-User: UserDirectory=Internal; UserId=sa_repository
Host: <sense-server-url>:4242
Connection: close
User-Agent: Paw/3.1.10 (Macintosh; OS X/10.15.5) GCDHTTPRequest
Content-Length: 0

 

 

 

No indication about the fact that a new reload task was created for this app. The response body is completely empty.

 

Sense_API_lab.png

But looking at what reload tasks exist for this app, we see that a new one has been created (img right), with a task ID of 210832b5-6174-4572-bd19-3e61eda675ef

My question is then: How can I get hold of that ID as part of the app reload?

Is there a solid way of doing this, except first creating a new reload task and then starting that task, instead of using the app/reload endpoint?

IMHO, expected behaviour would be that the call to /app/{id}/reload would return the task ID of the started task in the response body. That's how APIs usually work, including the Qlik Cloud ones (example here). 

 

 

Please mark the post as a solution if it provided you with a solution to the topic at hand. Thanks!
Labels (4)
3 Replies
Manoj_Prabu
Contributor III
Contributor III

Hi @mountaindude ,

did you find the solution. if yes please share the solution, I'm too having the same issue.

Thanks

mountaindude
Luminary Alumni
Luminary Alumni
Author

@Hi @Manoj_Prabu 

Yeah I solved it, the suggested solution in the edit of the original post does work. I.e. first create a reload task (you will get its ID), then start the task, store the ID somewhere etc.

It's really just two API calls to start a reload instead of one, so no biggie.

My code isn't really good for sharing right now... It's a Javascript/Node.js based visual scheduler for Sense, drag-n-drop editing of schedules.
Works really well, but cleanup needed before it can be released. Sorry..

Please mark the post as a solution if it provided you with a solution to the topic at hand. Thanks!
Manoj_Prabu
Contributor III
Contributor III

Hi @mountaindude,

Thanks for the reply. I'll try as you mentioned above and let you know.

Thanks.