Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How to pass restful query parameters dynamically to restful call

Hello Support,

I have 2 questions:

1. How to dynamically pass the restful query parameters?
    for example: I have a restful API that get me a 64 base image. My restful call takes 2 parameters: ID and Date.
                         I created a restful connection inside Qlik sense and I hardcoded my 2 query parameters ID and Date.

                         I get successfully the image. However, I want to be able to pass those parameters dynamically so I can different

                         image for different ID and date.

2. I have created a Qlik sense extension. In my extension, I have a folder images/.
    The output of my extension is html element constructed in the paint method.
    I want to be able to display images inside my html element that are coming from images/ folder.

    Example: My extension name is DisplayOrderSection and inside DisplayOrderSection, i have images folder that has images:
    DisplayOrderSection/images/order1.jpg


    In my html, I have an html image tag,

                         var imagePath = "Extensions/DisplayOrderSection /images/";

                         var order1Image = '<img src=' + imagePath + 'order1.jpg>';

                         $element.append(order1Image);

                         return qlik.Promise.resolve();

the image is not displayed in item 2.

Please let me know.

Thank you.

4 Replies
Not applicable
Author

Any update regarding this issue?

shubham_singh
Partner - Creator II
Partner - Creator II

1.

Turn ON legacy mode in Qlik, there is a direct option to do that on server but for Desktop modify the setting.ini file in Documents/Qlik/Sense and paste below code

[Settings 7]

StandardReload=0

OverrideScriptSecurity=1


Open qlik view and generate a script for loading data from Rest web service, you might need to install rest connector first.

Then copy the script, paste it into Qlik Sense, identify your arguments in autogenerated script, replace it with a variable.

Create a loop outside the autogenerated script, modify value of variable through every iteration.

Note: Do not modify rest master table script other than your arguments.

2. Don't know much about HTML or Javascript.

Not applicable
Author

I have Qlik Sense version:

  • Qlik Sense Communication 12.2.0
  • Qlik Sense Common 13.1.0
  • .NET SDK 12.1.4
  • Client 3.35.6
  • QIX Engine 4.11.10
  • Service Dispatcher 12.0.6
  • App Migration Service 4.5.1
  • Data Preparation Service 2.1.2
  • Broker Service 5.0.8
  • Proxy 11.3.2
  • Repository 12.2.9
  • Scheduler 11.4.2
  • Printing Service 11.2.5
  • Hub Service 0.13.0
  • Qlik Sense Browser 4.2.2
  • Qlik DataMarket Connector 2.2.1.10
  • Qlik REST Connector 1.1.0.2889
  • Qlik SalesForce Connector 14.1.0.2147
  • Qlik Essbase Connector 1.0.1.2256
  • Qlik ODBC Connector 1.2.1.2189

I don't have Qlik view.

Please let me know what you meant by open Qlik view and generate the script

Thank you.

Not applicable
Author

Hello Shubham,

Please tell me what portion of the script that I should take and put it in the extension.

Do you have an example of an extension that calls REST with Dynamic parameters?

______________________________________________

LIB CONNECT TO 'GetBNSImage';

[records]:

LOAD "cycle_date" as "cycle_date",

  "back_image" as "back_image",

  "isn" as "isn",

  "front_image" as "front_image";

SQL SELECT

  "cycle_date",

  "back_image",

  "isn",

  "front_image"

FROM JSON (wrap off) "records";

[records_temp_3151abf7-90f5-c3b7-cd96-4f0d2f19]:

LOAD

  '-' AS [Extra_0871c84d-48ee-d40e-594b-b1381fc2],

  Date(Date#([cycle_date], 'YYYYMMDD') ) AS [cycle_date],

  [back_image],

  [isn],

  [front_image]

RESIDENT [records];

DROP TABLE [records];

DROP FIELD [Extra_0871c84d-48ee-d40e-594b-b1381fc2];

RENAME TABLE [records_temp_3151abf7-90f5-c3b7-cd96-4f0d2f19] TO [records];

[autoCalendar]:

  DECLARE FIELD DEFINITION Tagged ('$date')

FIELDS

  Dual(Year($1), YearStart($1)) AS [Year] Tagged ('$axis', '$year'),

  Dual('Q'&Num(Ceil(Num(Month($1))/3)),Num(Ceil(NUM(Month($1))/3),00)) AS [Quarter] Tagged ('$quarter', '$cyclic'),

  Dual(Year($1)&'-Q'&Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [YearQuarter] Tagged ('$yearquarter', '$qualified'),

  Dual('Q'&Num(Ceil(Num(Month($1))/3)),QuarterStart($1)) AS [_YearQuarter] Tagged ('$yearquarter', '$hidden', '$simplified'),

  Month($1) AS [Month] Tagged ('$month', '$cyclic'),

  Dual(Year($1)&'-'&Month($1), monthstart($1)) AS [YearMonth] Tagged ('$axis', '$yearmonth', '$qualified'),

  Dual(Month($1), monthstart($1)) AS [_YearMonth] Tagged ('$axis', '$yearmonth', '$simplified', '$hidden'),

  Dual('W'&Num(Week($1),00), Num(Week($1),00)) AS [Week] Tagged ('$weeknumber', '$cyclic'),

  Date(Floor($1)) AS [Date] Tagged ('$axis', '$date', '$qualified'),

  Date(Floor($1), 'D') AS [_Date] Tagged ('$axis', '$date', '$hidden', '$simplified');

DERIVE FIELDS FROM FIELDS [cycle_date] USING [autoCalendar] ;