Below is an example of using the 'REST' connector.
We need to load data from an online data source, we have a URL to connect to the data that contains the ID of each one of the elements that we would like to load into our app.
We have a list of 100 alphanumeric elementIDs and we need to make sure we load them all. Using our REST connector, we could easily connect to the online data source and extract the data, but we faced the issue of how to make to connection loop trough a series of items.
In our example we have an inline table that contains each one of the ID numbers of the elements we want to read in the REST connector, and we need to pass that parameter to the connection URL below.
LIB CONNECT TO 'REST'; ElementsToLoad: Load * inline [ ElementID 12fa91 1sy293 h13d13 … ]; Let j=0; for j = 0 to 99 Let vElementID = peek('ElementID', $(j), 'Teams'); RestConnectorMasterTable: SQL SELECT fields FROM "datad") FROM JSON (wrap on) "root" PK "__KEY_root" WITH CONNECTION(Url "https://www.domain.com/element?key=$(vElementID)/more_stuff/"); NEXT j; DROP TABLE RestConnectorMasterTable; exit Script;
After the inline statement, we loop over the REST connection 100 times, one time for each row of the inline table, I know we have 100 rows so I'm hard coding that number but if you don't know how long your table is you should check that before and store it in a variable.
For more information, visit https://community.qlik.com/t5/Qlik-Design-Blog/REST-connector-Using-WITH-CONNECTION/ba-p/1523257