Code Monkey home page Code Monkey logo

q-risotto's Introduction

q-risotto

Qlik REST In Sense (otto) - a RESTful Engine API wrapper

Inspired by project chartcacher by Alexander Karlsson.

q-risotto

The intention was to provide an easy access to apps, objects and its data on a Qlik Sense server thru a REST API to integrate with other systems.

We at TIQ Solutions do provide a support and maintenance subscription for this project and also customization. There is also a commercial version on it's way having more endpoints and authentication.

Endpoints

See also: routes.js

GET /v1/docs - all docs on server, returns getDocList().qDocList

GET /v1/doc/{docId} - app layout, returns getAppLayout().qLayout

GET /v1/doc/{docId}/objects - all objects of app, returns getAllInfos().qInfos

GET /v1/doc/{docId}/serialize - serialize an app into a JSON object, more details here: mindspank/serializeapp

GET /v1/doc/{docId}/object/{objId} - object layout, returns getLayout().qLayout

GET /v1/doc/{docId}/object/{objId}/layout - layout data, returns getLayout().qLayout depending on object type it contains qHyperCube and qDataPages

GET /v1/doc/{docId}/object/{objId}/data - object data, returns first data page of either getLayout().qHyperCube or qListObject depending on object type chart/listbox, not data for pivot tables

GET /v1/doc/{docId}/object/{objId}/pivotdata - object data, returns getLayout().qPivotDataPages for pivot tables

GET /v1/doc/{docId}/object/{objId}/layers - object data, returns getLayout().layers for maps

POST /v1/doc/{docId}/hypercube - give a column list array or HyperCubeDef JSON as payload (request body) and get back the evaluated getLayout().qHyperCube, without data page

Examples for payload to define a hypercube:

  1. a list of columns as string, measures start with equal sign, all others are treated as dimensions (hint: use brackets for dimensions):
[
    "[Date.autoCalendar.Date]",
    "[Case Owner Group]",
    "=Avg([Case Duration Time])",
    "=Count({$<Status -={'Closed'} >} Distinct %CaseId )"
]
  1. a list of NxDimension and NxMeasure structure objects, can be mixed with column strings like in 1.:
 [
    "[Date.autoCalendar.Date]",
    {"qDef": {"qFieldDefs": ["Case Owner Group"], "qFieldLabels": ["Group"]}},
    {"qDef": {"qDef": "=Avg([Case Duration Time])", "qLabel": "Avg Case Duration Time"}},
    {"qDef": {"qDef": "=Count({$<Status -={'Closed'} >} Distinct %CaseId )", "qLabel": "Open Cases"}}
]
  1. a HyperCubeDef (see link below)

See Qlik help also:

POST /v1/doc/{docId}/hypercube/size - give a give a column list array or HyperCubeDef JSON as payload (request body) and get back the evaluated size of getLayout().qHyperCube as the following JSON object:

{
    "columns": 3,
    "rows": 89,
    "pages": 1
}

POST /v1/doc/{docId}/hypercube/json/{pageNo*} - give agive a column list array or HyperCubeDef JSON as payload (request body) and get back the evaluated getLayout().qHyperCube.qDataPages[0].qMatrix (the first data page or page number given as last URL param) transformed into a JSON collection of data rows (eg. easy to use with Qlik REST Connector), date and timestamps are delivered in UTC-time:

[
    {
        "Date": "2014-10-11T22:00:00.000Z",
        "Cumulative New Cases": 4,
        "Cumulative Closed Cases": 0
    },
    {
        "Date": "2014-10-18T22:00:00.000Z",
        "Cumulative New Cases": 5,
        "Cumulative Closed Cases": 3
    },
...
]

Static Resources

GET /wdc - Tableau WDC to connect q-risotto endpoint /v1/doc/{docId}/hypercube/json

Installing

cd sources

npm install

Qlik Sense Service Dispatcher Integration

  • Copy the files manually with admin priviliges into
    C:\Program Files\Qlik\Sense\ServiceDispatcher\Node\q-risotto\

  • Then append the following configuration options to
    C:\Program Files\Qlik\Sense\ServiceDispatcher\services.conf
    This will let the Service Dispatcher know how to run the module, this step has to be re-applied in an upgrade of Qlik Sense Server.

[q-risotto]
Identity=Qlik.q-risotto
Enabled=true
DisplayName=q-risotto
ExecType=nodejs
ExePath=Node\node.exe
Script=Node\q-risotto\server.js

[q-risotto.parameters]

Qlik Sense Server Integration

Adjust ./src/config/config.json to work with a Qlik Sense Server like this:

{
    "enigmaSchema": "enigma.js/schemas/12.34.11.json",
    "engineHost": "<your Qlik Sense Server hostname or IP>",
    "enginePort": 4747,
    "globalAppId": "engineData",
    "userDirectory": "Internal",
    "userId": "sa_repository",
    "certificatesPath": "C:/ProgramData/Qlik/Sense/Repository/Exported Certificates/.Local Certificates",
    "port": 3000
}

Qlik Core Integration

Adjust ./src/config/config.json to work with the dockerized QIX engine like this:

{
    "enigmaSchema": "enigma.js/schemas/12.34.11.json",
    "engineHost": "qix-engine",
    "enginePort": 9076,
    "globalAppId": "engineData",
    "userDirectory": null,
    "userId": null,
    "certificatesPath": null,
    "port": 3000
}

Use the docker-compose.yml file provided in the repo and start it:

docker-compose up

Usage

Config

See config.json for configurations.

Start on Qlik Sense server with npm start or integrate into Qlik Sense ServiceDispatcher.

Navigate with browser or other tools to https://<qlik sense server name>:1338/<endpoint>

Postman

Test q-risotto API calls with Postman: q-risotto with Postman

QlikView

Use QlikView with the Qlik REST Connector to retrieve data from Qlik Sense: q-risotto with QlikView REST connector q-risotto with QlikView REST connector 2

Tableau

Use q-risotto WDC with Tableau to retrieve data from Qlik Sense: q-risotto with Tableau q-risotto with Tableau q-risotto with Tableau

R Integration

Use q-risotto in your R environment and retrieve data from Qlik Sense. Here you will find the R convenience package 'senser' to wrap q-risotto and complex Qlik structs like qHyperCubeDef:

https://github.com/ralfbecher/senser

Using senser R package


Author

Ralf Becher

License

Copyright © 2016 Ralf Becher

Released under the MIT license.


q-risotto's People

Contributors

ralfbecher avatar wbvreeuwijk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

q-risotto's Issues

Qlikview REST connector doesn't works with Risotto

Hello,
I'm trying to follow what you wrote about using QlikView with the Qlik REST Connector to retrieve data from Qlik Sense.

Could you explan deeper each needed step ?

I can't find the hypercube just created before using Postman.

Thanks for your support.

Best Regards
Andrea

One certificate used

There is one certificate key pair used for both the communication with Qlik and for encryption of the external interface (in server.js and session.js)
This becomes a problem when using the self-signed interface on the external interface.

Row with null values returned when measures are used within a formula

Hi, not sure if this is still being maintained, so apologies in advance if it is not.

I use Q-Risotto extensively for QA purposes and recently following a Qlik Sense upgrade, we started using measures within formulas and rows containing fields referencing measures are returning nulls instead of values. Here's an example:

image

When I retrieve data using say https://10.xxx.xxx.xxx:3000/v1/doc/bb9f488f-34ce-4454-a94a-bf429cc727ea/object/WwbeGXZ/data , data is returned normally except where fields contain formulas that directly reference measures; the blued out area in the screenshot are the actual 'blank' records corresponding to fields using measures within the formulas:

image

Not sure if I'm being clear but was hoping that perhaps you can point me into the right direction even if it means modifying the api myself.

Thanks!

develop an R convenience package for q-risotto usage

As shown in README.md you can already use q-risotto in R with the httr package.

However, this is nothing for typical R user. So wee need an convenience package to encapsulate the complexity and make it easy to use.

selection possibilty

create a way to pass a selection (as JSON payload or else) before HyperCube data are retrieved

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.