Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
khasimvali85
Creator II
Creator II

QlikSense REST Connector Post Method (into the script) using JSON

Hi Team,

I am also facing same kind of issue where dynamically changing the values from script using variable as follows.

if i am passing the values as character and number into the variable(vtokenvalue ) the script working fine, while passing the value like (?Hu7?$(\"e) getting the error from attached screen.

Please suggested me to resolve this issues.

Please find attached sample script for reference.

LET vtokenvalue ='?Ax6?$(\"e';
LET vRequestBody = '{"Name":"Ravindra", "address":"$(vtokenvalue)"}';
LET vRequest=Replace(vRequestBody,'"',Chr(34)&Chr(34));
LIB CONNECT TO 'Rest_Json_Test (cb_npgmr05)';
RestConnectorMasterTable:
SQL SELECT
"Name",
"address",
"id",
"createdAt"
FROM JSON (wrap on) "root"

WITH CONNECTION (HTTPHEADER "Content-Type" "application/json;charset=utf-8",
HTTPHEADER "Accept" "text/plain",
BODY "$(vRequest)");

[root]:
LOAD [Name] AS [Name],
[address] AS [address],
[id] AS [id],
[createdAt] AS [createdAt]
RESIDENT RestConnectorMasterTable;
DROP TABLE RestConnectorMasterTable;

Thanks in Advance!!

Thanks & Regards,

Khasimvali Shaik

1 Reply
vunguyenq89
Creator III
Creator III

Hi,

The "$(" part in your API token seems to trigger a dollar sign expansion. There is no way to prevent Qlik engine from evaluating dollar sign expansion as far as I'm aware of. You may consider generating another token.

BR,

Vu Nguyen