Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

jonathanpoyer
Contributor

With Connection statement - What are all the parameters possible?

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!

1 Solution

Accepted Solutions
MVP
MVP

Re: With Connection statement - What are all the parameters possible?

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.

6 Replies
MVP
MVP

Re: With Connection statement - What are all the parameters possible?

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.

jonathanpoyer
Contributor

Re: With Connection statement - What are all the parameters possible?

Thank you Petter, I will check that now!

Is there any possibility to change also the METHOD?

Best regards,

MVP
MVP

Re: With Connection statement - What are all the parameters possible?

Not that I know of. I will do an extra check...

pauldamen
Contributor II

Re: With Connection statement - What are all the parameters possible?

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

stellanr
New Contributor II

Re: With Connection statement - What are all the parameters possible?

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

rohitk1609
Valued Contributor II

Re: With Connection statement - What are all the parameters possible?

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