Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
woutermak
Partner - Creator III
Partner - Creator III

Use of variables in rest connection.

Hi,

I'm using a REST connection to get my data. But I create for each end point a new connection.

See the picture below:
My first connection is to https://test.webshop.nl/api/data/v4.1/customer
My second connection is to https://test.webshop.nl/api/data/v4.1/address
My third connection is to https://test.webshop.nl/api/data/v4.1/shipto

Is there a possibility to use a variable, something like https://test.webshop.nl/api/data/v4.1/$(V_connnection)
Or is there a smarter solution.

Please let me know.
Wouter

Rest_connection.JPG

Labels (1)
1 Solution

Accepted Solutions
ChiragPradhan
Creator II
Creator II

Hi,

Once you have connected to the API,

You could something like this -

Let V_Connection = 'Customer';
Let vURL = '<a href="https://test.webshop.nl/api/data/v4.1/" target="_blank">https://test.webshop.nl/api/data/v4.1/</a>' & V_Connection;

Trace $(vURL);

RestConnectorMasterTable:
SQL SELECT 
	'
    '
    '
    '
FROM JSON (wrap on) "root"
WITH CONNECTION(Url "$(vURL)");
;

[root]:
LOAD
	'
	"
    "
    "
    "
    '
RESIDENT RestConnectorMasterTable;


DROP TABLE RestConnectorMasterTable;

 

If it is what you are looking for, please consider marking it as resolved.

Regards,

Chirag

View solution in original post

3 Replies
ChiragPradhan
Creator II
Creator II

Hi,

Once you have connected to the API,

You could something like this -

Let V_Connection = 'Customer';
Let vURL = '<a href="https://test.webshop.nl/api/data/v4.1/" target="_blank">https://test.webshop.nl/api/data/v4.1/</a>' & V_Connection;

Trace $(vURL);

RestConnectorMasterTable:
SQL SELECT 
	'
    '
    '
    '
FROM JSON (wrap on) "root"
WITH CONNECTION(Url "$(vURL)");
;

[root]:
LOAD
	'
	"
    "
    "
    "
    '
RESIDENT RestConnectorMasterTable;


DROP TABLE RestConnectorMasterTable;

 

If it is what you are looking for, please consider marking it as resolved.

Regards,

Chirag

woutermak
Partner - Creator III
Partner - Creator III
Author

Yes it works for me.
Sometimes it's easier to create the connection in QlikView and load the data. Copy the of the script code to your Sense Solution. You can use the end of the connection part of the code for the variable V_Connection.

Wouter

 

msuvarna
Contributor
Contributor

Hi,

I am new to Qlik so please pardon if my question is silly.

I am trying to achieve something similar but when I insert the URL it shows error. Could you please let me know how can I proceed further?

msuvarna_1-1649227203291.png

Also,  do we need to change the REST connection URL to match the same ?

msuvarna_0-1649226673083.png