Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hello,
I am trying to figure out what are all the possibilities in the WITH CONNECTION statement when using the REST connector.
I've been through all of this and I am currently using the "Url" parameter.
When I am trying to use Url and QUERY parameters in the same statement I can't make it work.
Would someone have the right syntax and all the parameters possible.
It looks like we can also override the body parameter when using a method POST, any help would be welcome on that matter too.
Another question: is it possible to override the method too (so having GET and POST for the same connection but overridden when useful to use POST instead of the GET method).
To summarize: what is the exact WITH CONNECTION statement syntax?
Exemple :
WITH CONNECTION (Url "YourURL"; Method : POST; Query Header: "Content-Type: application/json; charset=utf8", "OtherHeaderName: OtherHeaderValue"; Query Parameters : "Field1: Value1","Field2: Value2"; Body : "{"ids":[ 1, 2, 5, 10 ]}")
Many thanks in advance!
WITH CONNECTION (
URL "new URL" ,
QUERY "param name" "param value",
HEADER "header name" "header value",
BODY "request body text"
)
QUERY and HEADER can be repeated for as many query parameters and headers you need to have.
WITH CONNECTION (
URL "new URL" ,
QUERY "param name" "param value",
HEADER "header name" "header value",
BODY "request body text"
)
QUERY and HEADER can be repeated for as many query parameters and headers you need to have.
Thank you Petter, I will check that now!
Is there any possibility to change also the METHOD?
Best regards,
Not that I know of. I will do an extra check...
Dear Peter,
I am facing a problem regarding the Connection from URL.
I need to make my URL dynamic in order to change the skip and take in the URL, URL looks like this "https://xxxx.nl/xxxxx/connectors/xxxxx?skip=0&take=5000'
But as soon as I take my URL out and try to make a variable it doesn't work anymore. Any thoughts how I can solve this problem?
Regards, Paul
Hello Paul,
I managed to change the URL like this by adding " " around the URL variable
//Build new URL.
LET vURL = 'https://api.www.abc.com/external/folder/folder/data/login?accesskey=123;
RestConnectorMasterTable:
SQL SELECT
"__KEY_root",
(SELECT
...
"__FK_rows"
FROM "rows" FK "__FK_rows")
FROM JSON (wrap on) "root" PK "__KEY_root"
WITH CONNECTION
( URL "$(vURL)");
Regards,
Stellan
Hey Peter,
I am middle of a problem same you were talking:
There is POST content which I am using in REST connector. POST content has a date "dateEnd" which I need to make dynamic
So for testing purpose, how data is getting replaced with WITH CONNECTION function
let vRequestBody = '{"dateEnd": "2016-04-01T08:50:53.082Z"}';
let vRequestBody = replace(vRequestBody,'"', chr(34));
then I am writing the code as
WITH CONNECTION(
BODY "$(vRequestBody)"
);
but this above code is giving me error:
Connector reply error: Unknown substring, string, or value at (50,23): '-04-01T08:50:53.082Z"}"'
Can you please help me to make POST content in REST connector dynamic ?
Thanks in advance!
Best,Rohit
Your code:
let vRequestBody = '{"dateEnd": "2016-04-01T08:50:53.082Z"}'; let vRequestBody = replace(vRequestBody,'"', chr(34));
Try this:
let vRequestBody = '{"dateEnd": "2016-04-01T08:50:53.082Z"}'; let vRequestBody = replace(vRequestBody,'"', chr(34)&chr(34));
Can we add table fields in "with connection" body so in Email body it should be reflect as below
ID Amount
23,10000
with connection (
QUERY "to" "v@gmail.com "
,QUERY "message" "Total Sales greater than >20000 for $(vID)"
//,QUERY "subject" "$(vID)"
,QUERY "fromName" "NoReply"
,QUERY "fromEmail" "v@hotmail.com"
)
Hi,
I am trying to connect API REST with Qlik. the api needs a csv file as input parameter but the error is:
// Realizar la solicitud POST a la API utilizando RestPost()
RestConnectorMasterTable:
SQL SELECT *
FROM JSON (wrap on) "root"
WITH CONNECTION(
Url "$(url)",
HTTPHEADER "Content-Type" "multipart/form-data",
BODY "file=@C:/Users/ol_av/OneDrive/Documentos/PROYECTO MLA/PROGRAMACION MLA/MATRIZ MLA/SCRIPTS/FLASK/data.csv"
);