Qlik Community

Qlik Sense Integration, Extensions, & APIs

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

iliasmansouri
New Contributor II

Connect to local Qlik Engine API using R

Hello all,

I'm trying to connect my local Qlik Sense using R in the R Studio environment. With the help of the Engine Explorer I created a JSON file which is then to be send to the Engine API and finally read back in in R Studio for further processing. This is the R code:

library(jsonlite)

Get_DocList <- function(){

  json <-

    '[

      {

      "handle": -1,

      "method": "GetDocList",

        "params": {}

      }

    ]'

  json <- fromJSON(json)

  return(json)

  #toJSON(json, pretty=TRUE)

}

con <- socketConnection(host="localhost", port = 4848, blocking=TRUE,server=FALSE, open="r+")

  stream_out(Get_DocList(), con)

  b <- stream_in(con)

 

  close(con)

When sending the JSON request I get a completion status message but when reading the data I get: " Imported 0 records. Simplifying..."

Can someone explain why I get no JSON-response?

Thanks in advance

1 Solution

Accepted Solutions
MVP
MVP

Re: Connect to local Qlik Engine API using R

Which R package are you using for WebSockets. From your code it looks to me like you are using normal Sockets communication and not WebSockets. If you are it will not work. Qlik use WebSockets for communication.

1 Reply
MVP
MVP

Re: Connect to local Qlik Engine API using R

Which R package are you using for WebSockets. From your code it looks to me like you are using normal Sockets communication and not WebSockets. If you are it will not work. Qlik use WebSockets for communication.

Community Browser