Qlik Community

Ask a Question

Connectivity & Data Prep

Discussion board where members can learn more about Qlik Sense Data Connectivity.

Announcements
Support Cases coming to Qlik Community Oct. 4! Start chats, open cases, explore resources: READ DETAILS
cancel
Showing results for 
Search instead for 
Did you mean: 
maxwjomdal
Contributor II
Contributor II

Passing a parameter to REST connector URL

Hi I'd like a way to dynamically change the URL connector string. This is an example:

LIB CONNECT TO 'StarWarsREST';

LET extension = "/people";

RestConnectorMasterTable:

SQL SELECT

"__KEY_root",

(SELECT

"name",

"created",

"__FK_results",

"__KEY_results"

FROM "results" PK "__KEY_results" FK "__FK_results")

FROM JSON (wrap on) "root"

WITH CONNECTION (

URL "$(extension)");

[root]:

LOAD [name] AS [name],

[created] AS [created]

RESIDENT RestConnectorMasterTable

WHERE NOT IsNull([__FK_results]);

DROP TABLE RestConnectorMasterTable;

'StarWarsREST' has the URL http://swapi.co/api and I want to make a connection to http://swapi.co/api/people. When I run this script to load data, if finishes without failure, but does not load any data. This is just an example. The ultimate goal is to change the extension variable in a nodejs script based on user input.

Thanks!

5 Replies
rscampbell
Contributor III
Contributor III

I did something similar where I had to go through a few pages (with a parm tweaked), but did this on the QLIK Sense Desktop.

Article that was useful:

https://community.qlik.com/thread/287822

You switch to legacy loading - but in doing so it can open up some security issues (other article did better explaining it).

While this code was from a prior way of doing it:

(looping through i a few times)

Set vUrl = 'http://whateverurl.html/results.aspx?p=$(i)&ps=20'

TriathlonResults:

    LOAD

FROM

    $(vUrl)

    (html, utf8, embedded labels, table is @1);

Hope this helps in solving your issue.


RSC

maxwjomdal
Contributor II
Contributor II
Author

Could you better describe what a script needs to look like on Qlik Sense Desktop to accomplish this? I am new to Qlik Sense and Scripting.

rscampbell
Contributor III
Contributor III

Maxwell,

I was mistaken - my example involved the web html pull vs. the RESTFUL part.


That being said, I think this particular is covered very well by the brilliant Michael Tarallo mto

on the following page (using the STAR WAR API):

Working with the Qlik REST Connector, Pagination and Multiple JSON Schemas

I hope this helps guide you to the right answer.


Robert

rscampbell
Contributor III
Contributor III

Tyler_Waterfall
Employee
Employee

I just use the

WITH CONNECTION(Url "https://content.googleapis.com/calendar/v3/calendars/primary/events?key=AIzaS...");


as mentioned in the help https://help.qlik.com/en-US/connectors/Subsystems/REST_connector_help/Content/Create-REST-connection... like rscampbell‌ mentions.


Just use a variable for the URL.


Select .... WITH CONNECTION(Url "$(web_page_variable)");