Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
ryanocni
Contributor III
Contributor III

LogFile Path Location if Reloading using QlikSense API

Hello Master,

Anyone know where is log file located when I reload the data using QlikSense API ?
When I searched from Apps ID in program data\qlik and program files\qlik, I didn't find the log file
But, I can download the log in QMC. Where is come from?
Or it's not be stored if reload using API?

Thank you

Labels (4)
1 Solution

Accepted Solutions
Levi_Turner
Employee
Employee

OK, so by calling POST /qrs/app/{id}/reload then you're creating a reload task with the name of "Manually triggered reload of {AppName}" if one does not already exist then the task is started.

The flow for that would be like this:

GET /qrs/reloadtask/full?filter=(app.id eq 53c667f8-b6b9-431e-991e-fd9f9bf5d38f and name sw 'Manually triggered reload of')
 
  • We're using a filter here where we're passing the App ID and ensuring that we only get the task whose name starts with Manually triggered reload of
 
Example response:

 

 

[
  {
    "id": "74083b5b-1f37-4075-b626-b4990610f6f6",
    "createdDate": "2020-02-24T16:05:19.601Z",
    "modifiedDate": "2020-02-24T16:05:19.601Z",
    "modifiedByUserName": "DOMAIN\\UserId",
    "customProperties": [],
    "app": {
      "id": "53c667f8-b6b9-431e-991e-fd9f9bf5d38f",
      "name": "Operations Monitor",
      "appId": "",
      "publishTime": "2020-03-20T12:28:06.445Z",
      "published": true,
      "stream": {
        "id": "a70ca8a5-1d59-4cc9-b5fa-6e207978dcaf",
        "name": "Monitoring apps",
        "privileges": null
      },
      "savedInProductVersion": "12.602.0",
      "migrationHash": "21ecc792c56e18162f1785d3d41f28fdaced5c96",
      "availabilityStatus": 0,
      "privileges": null
    },
    "isManuallyTriggered": true,
    "operational": {
      "id": "c02e073f-10ca-482b-93c3-61903a97d6ff",
      "lastExecutionResult": {
        "id": "413b7ad7-434e-4014-916d-466f3099142a",
        "executingNodeName": "myQlikSite.domain.tld",
        "status": 7,
        "startTime": "2020-02-24T16:05:20.391Z",
        "stopTime": "2020-02-24T16:07:42.638Z",
        "duration": 142247,
        "fileReferenceID": "c504bcf7-cb11-424f-8222-3b9492e8f285",
        "scriptLogAvailable": false,
        "details": [
          ...
        ],
      }
    },
    "name": "Manually triggered reload of Operations Monitor",
    "taskType": 0,
    "enabled": true,
    "taskSessionTimeout": 1440,
    "maxRetries": 0,
    "tags": [],
    "privileges": null,
    "schemaPath": "ReloadTask"
  }
]

 

 

  • Note the id & operational.lastExecutionResult.id values

 

GET /qrs/ReloadTask/74083b5b-1f37-4075-b626-b4990610f6f6/scriptlogfile?executionResultId=c02e073f-10ca-482b-93c3-61903a97d6ff

 

Example Response:

 

 

{
  "value": "e1bfd9a7-664d-4d90-b625-b0770e557efb"
}

 

 

GET /qrs/download/reloadtask/e1bfd9a7-664d-4d90-b625-b0770e557efb/someArbitraryName.log

View solution in original post

8 Replies
Levi_Turner
Employee
Employee

I am not sure what API you're referring to. From a high level you have two ways of reloading an app:

  1. Reloads in the Hub
  2. Reloads in the QMC

(1) is functionally using the Engine API. This reload does generate a script log  but it is not presented to the Qlik Repository Service and thus there's no direct way of accessing this file outside of opening the file on the file system of the server(s) or similar method. See this article for reference.

(2) involves a task. Tasks are artifacts of the Qlik Repository Service. This service does have an awareness of script logs in order to be able to surface them in the QMC.

I suspect you're interested in (1) and in which case, it will not be presented through Qlik and thus you'd need to access the file on the file system.

ryanocni
Contributor III
Contributor III
Author

Thanks Levi,

I used App : Reload API like below :
qrs/app/0d522667-fd85-4f84-ae25-4784823ecfc7/reload?Xrfkey=iX83QmNlvu87yyAB

So, you mean I should try Task : Start API ?
/qrs/task/{id}/start/synchronous

How to find {id} of Task?
Because when I open the task, the generated code always changes

Levi_Turner
Employee
Employee

OK, so by calling POST /qrs/app/{id}/reload then you're creating a reload task with the name of "Manually triggered reload of {AppName}" if one does not already exist then the task is started.

The flow for that would be like this:

GET /qrs/reloadtask/full?filter=(app.id eq 53c667f8-b6b9-431e-991e-fd9f9bf5d38f and name sw 'Manually triggered reload of')
 
  • We're using a filter here where we're passing the App ID and ensuring that we only get the task whose name starts with Manually triggered reload of
 
Example response:

 

 

[
  {
    "id": "74083b5b-1f37-4075-b626-b4990610f6f6",
    "createdDate": "2020-02-24T16:05:19.601Z",
    "modifiedDate": "2020-02-24T16:05:19.601Z",
    "modifiedByUserName": "DOMAIN\\UserId",
    "customProperties": [],
    "app": {
      "id": "53c667f8-b6b9-431e-991e-fd9f9bf5d38f",
      "name": "Operations Monitor",
      "appId": "",
      "publishTime": "2020-03-20T12:28:06.445Z",
      "published": true,
      "stream": {
        "id": "a70ca8a5-1d59-4cc9-b5fa-6e207978dcaf",
        "name": "Monitoring apps",
        "privileges": null
      },
      "savedInProductVersion": "12.602.0",
      "migrationHash": "21ecc792c56e18162f1785d3d41f28fdaced5c96",
      "availabilityStatus": 0,
      "privileges": null
    },
    "isManuallyTriggered": true,
    "operational": {
      "id": "c02e073f-10ca-482b-93c3-61903a97d6ff",
      "lastExecutionResult": {
        "id": "413b7ad7-434e-4014-916d-466f3099142a",
        "executingNodeName": "myQlikSite.domain.tld",
        "status": 7,
        "startTime": "2020-02-24T16:05:20.391Z",
        "stopTime": "2020-02-24T16:07:42.638Z",
        "duration": 142247,
        "fileReferenceID": "c504bcf7-cb11-424f-8222-3b9492e8f285",
        "scriptLogAvailable": false,
        "details": [
          ...
        ],
      }
    },
    "name": "Manually triggered reload of Operations Monitor",
    "taskType": 0,
    "enabled": true,
    "taskSessionTimeout": 1440,
    "maxRetries": 0,
    "tags": [],
    "privileges": null,
    "schemaPath": "ReloadTask"
  }
]

 

 

  • Note the id & operational.lastExecutionResult.id values

 

GET /qrs/ReloadTask/74083b5b-1f37-4075-b626-b4990610f6f6/scriptlogfile?executionResultId=c02e073f-10ca-482b-93c3-61903a97d6ff

 

Example Response:

 

 

{
  "value": "e1bfd9a7-664d-4d90-b625-b0770e557efb"
}

 

 

GET /qrs/download/reloadtask/e1bfd9a7-664d-4d90-b625-b0770e557efb/someArbitraryName.log

ryanocni
Contributor III
Contributor III
Author

Thanks a lot Levi

ryanocni
Contributor III
Contributor III
Author

Hi Levi,

In using this API, do we need 'body' json in PostMan?

Because my response was blank

Thank you for your help

Levi_Turner
Employee
Employee

No, no body is required (or even permitted since this is a GET rather than a POST or PUT).

ryanocni
Contributor III
Contributor III
Author

Hi Levi,

How to know if data reload was success or failed?
Is there any idea to get data reload status immediately after it's finished?

Thank you

Levi_Turner
Employee
Employee

So there are two elements here:

  1. Using the REST API, how can I tell if a task has succeeded or failed?
  2. How can I get this data ASAP?

 

For (1), if you look at the GET of the ReloadTask, you'll see a operational.lastexecutionresult.status value. Like so:

 "operational": {
      "id": "c02e073f-10ca-482b-93c3-61903a97d6ff",
      "lastExecutionResult": {
        "id": "413b7ad7-434e-4014-916d-466f3099142a",
        "executingNodeName": "myQlikSite.domain.tld",
        "status": 7
...

This status code maps to the enums for tasks (via GET /qrs/about/openapi/main):

    "TaskExecutionStatus": {
      "type": "integer",
      "enum": [
        0,
        1,
        2,
        3,
        4,
        5,
        6,
        7,
        8,
        9,
        10,
        11,
        12
      ],
      "x-enumNames": [
        "NeverStarted",
        "Triggered",
        "Started",
        "Queued",
        "AbortInitiated",
        "Aborting",
        "Aborted",
        "FinishedSuccess",
        "FinishedFail",
        "Skipped",
        "Retry",
        "Error",
        "Reset"
      ]
    }

  

As for how to get the data ASAP, when it comes to REST APIs you have two approaches:

a. Polling
b. pub/sub

For (a), just call the endpoints that you need frequently. This is easy to implement but you would want to be reasonable in your polling intervals, right? Every second is too much.

For (b), the Qlik Repository API has what are called Notifications. For more details on those see this blog post. But in brief, you're telling the QRS to send you some data every time something fulfills the criteria. This capability is extremely powerful and real-time, but there is going to be more developmental effort for this task. You'd not only need the script / program to query the endpoint and map the status. But you'd also want some server listening for the JSON message in order to be triggered.