user3925023
user3925023

Reputation: 687

QLIK Sense - REST api chain call

I need to integrate data in my Qlik Sense project using cloud REST api. I need to call a chain of API as I firstly need the Token

Basically: 1) "Token" REST passing user+psw getting token 2) "API2" REST passing token received from 1 in the BODY

I think I need to use the data script feature, I'm able to create separately the 2 REST call, but how can I pass tokn dinamically in the Body?

Is there a specific code to be added? Thx

Upvotes: 0

Views: 634

Answers (1)

user3925023
user3925023

Reputation: 687

Find an answer here: https://community.qlikview.com/thread/224957

Basically just edit and parse Body variable:

let vRequestBody = '{"call":"ListarCategorias","app_key":"XXXXXXXX","app_secret":"XXXXXXXXXX","param":[{"pagina":"$(vPagina)","registros_por_pagina":100,"apenas_importado_api":"N"}]}';

let vRequestBody = replace(vRequestBody,'"', chr(34)&chr(34));

and use this at the end of "RestConnectorMasterTable" default scripting snippet WITH CONNECTION(BODY "$(vRequestBody)"):

    RestConnectorMasterTable:

SQL SELECT

  "__KEY_root",

  (SELECT

  "codigo",

  "totalizadora",

  "transferencia",

  "__FK_categoria_cadastro"

  FROM "categoria_cadastro" FK "__FK_categoria_cadastro")

FROM JSON (wrap on) "root" PK "__KEY_root"

WITH CONNECTION(BODY "$(vRequestBody)");

Upvotes: 1

Related Questions