Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Not applicable

Syntax to change URLs and Query Parameters using WITH CONNECTION

I have a column of URLs, in Excel: I want to load all of them.

And I may allow user to change URL query parameters via the same Excel.

I don't want to create separate Qlik Sense REST Data connections for each.

Can I use the "WITH CONNECTION"? I'm sure I can.

WITH CONNECTION keyword

The REST Connector supports the WITH CONNECTION keyword, which can be used to override URLs, query parameters and query headers in a connection. The POST body can also be overridden when the POST method has been selected for the connection. WITH CONNECTION allows you to alter some parts of a connection rather than create a separate connection.

I can find two examples:

Modifying the URL:

WITH CONNECTION(Url "http://rd-xxx-win8.rdfund.hypertek.com:1337");


Modifying the Query parameters:

WITH CONNECTION(QUERY "startAt" "$(startAt)");


But I can't see where this "WITH CONNECTION" syntax is described -- does anyone have a link? Like in Backus-Naur form which Qlik help uses for other syntaxes.


Tags (1)
6 Replies
Partner
Partner

Re: Syntax to change URLs and Query Parameters using WITH CONNECTION

‌Hi Nathaniel,

the the correct syntax is

WITH CONNECTION (

URL "new URL" ,

QUERY "param name" "param value",

HEADER "header name" "header value",

BODY "request body text"

)

The answer from Petter in the full context.

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

Not applicable

Re: Syntax to change URLs and Query Parameters using WITH CONNECTION

Thank you, maybe your answer is the best source of syntax;

I'll wait before accepting your answer as  I was hoping for a more definitive/authoritative source/documentation.

Partner
Partner

Re: Syntax to change URLs and Query Parameters using WITH CONNECTION

Unfortunately there is no more information on the web currently nor on the help.

You may log a ticket in order for Qlik to update their help.

pre
New Contributor

Re: Syntax to change URLs and Query Parameters using WITH CONNECTION

Note HEADER should be HTTPHEADER (at least in QSE 3.2 and above)

Highlighted
Partner
Partner

Re: Syntax to change URLs and Query Parameters using WITH CONNECTION

I have an issue too.

Screenshot_2.png

It fails when i use WITH CONNECTION. I think the problem is the Header but im not sure what is exaclty the problem.

Hope you can help me

bjendrick
New Contributor III

Re: Syntax to change URLs and Query Parameters using WITH CONNECTION

Qlik Sense 3.1 SR4

I've had to fight through this over the last week... our URL required 2 query parameters, both "start_date" and "end_date".  In order to get that to work successfully, I had to set values in the initial REST connection setup, allow it to verify, and save the connection.  Then in code, I had to do the following:

    FROM CSV (header off, delimiter "|", quote """") "CSV_source"

    WITH CONNECTION (

        QUERY "start_date" "$(vCurrentStartDate)",

        QUERY "end_date" "$(vCurrentEndDate)"

        );

I'm sure there's someone out there that could use this with their connections.  Good luck!