Qlik Community

Qlik Sense Integration, Extensions, & APIs

Discussion board where members can learn more about Integration, Extensions and API’s for Qlik Sense.

Not applicable

Pass variables to REST API connection string

Hi Experts,

I am using Qlik Sense desktop 3.1 on Windows 10. I am trying to use Google Maps Geocoding REST API in my Qlik Sense application. The plan is use this API to retrieve the Lat, Long coordinates for the city dimension for maps based visualisation. The Google Maps API has following format

https://maps.googleapis.com/maps/api/geocode/json?address=Stockholm&key=YOUR_API_KEY


From the above url we can see that the address parameter is where I need to pass the city and it forms the part of the Query Paramters in the Qlik Rest Connector. My plan is to have a For loop and pass all the cities I have to address query parameter save the co-ordinates in a seperate table.

My Observation

  1. I tried using a variable '$(b)' in the connection and then assign the variable the value before connecting Rest connection but it does not pass the right value. Instead it used passes the 'b' as text and not the value

Question

In the current release (Qlik Sense 3.1 Desktop)

  • Can a Query parameter be parameterised to achieve what I am looking for?
  • If not, is there a work around?

Thanks in Advance.

regards,

Puneet

Tags (2)
1 Reply
businessajit2
New Contributor III

Re: Pass variables to REST API connection string

Hi Puneet,

Assuming you have not resolved this yet - here is what I have done to parameterise a query parameter

I used custom pagination to let QS provide me with a query template to use the For ... Next loop, initiated a counter (CounterA) to load the pages, and constructed the URL by passing the counter value.

RestConnectorMasterTable:

SQL Select .....

From ....

With Connection (URL "https://api.example.com/companies?page_number= $ (CounterA)" );

The loop was stopped when CounterA = total count.


Similarly, I am using a preexisting table to read field values and construct the URL to fetch only required details. So I would say yes, it is possible to 'parameterise' a query parameter. Check the documentation at Select REST data with the Data load editor ‒ Qlik Connectors

Also check Bjorn's response here - Re: REST CONNECTOR locate the Authorization token


hope this helps.

thanks,

Ajit


Community Browser