我需要使用云REST api在我的Qlik Sense项目中集成数据。我需要调用API链,因为我首先需要令牌
基本上:1)“Token”REST传递用户+ psw获取令牌2)“API2”REST传递令牌从BODY中的1收到
我想我需要使用数据脚本功能,我可以单独创建2个REST调用,但是如何在Body中传递tokn dinam?
是否有特定的代码要添加?谢谢
在这里找到答案:https://community.qlikview.com/thread/224957
基本上只需编辑和解析Body变量:
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));
并在“RestConnectorMasterTable”默认脚本代码片段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)");