Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
aytac
Contributor
Contributor

Call an API via Qliksense to import daily data

Dear all,

There is an API available for me to get daily data for a given date. I would like to run this each day after the end of the day to append it into the existing data.  Below is the link I will use with the parameters.

https://api.xxx.com/{channel_id}/results?access_key={project access_key}&date={YYYYMMDD}

So, should I use rest api to do this on Qlik sense cloud? How can I dynamically set it up in the script and what is the best methodology to append data everyday?

Thank you!

Labels (2)
1 Solution

Accepted Solutions
Levi_Turner
Employee
Employee

As I understand the question, you're after passing a variable into a URL in a REST Connection which accepts a param of a date.

With that understanding, I believe the WITH CONNECTION capability of the REST Connector is what you're after. With your example this would be done like so:

// Parse current date

vDate = Date(Now(), 'YYYYMMDD');

LIB CONNECT TO 'My ConnectionName';

RestConnectorMasterTable:
SQL SELECT 
 ...
FROM JSON (wrap on) "root" PK "__KEY_root"
WITH CONNECTION(
    URL "https://api.xxx.com/{channel_id}/results?access_key={project access_key}&date=$(vDate)"
);

View solution in original post

3 Replies
Brett_Bleess
Former Employee
Former Employee

Have you checked out the following Help Doc, believe it may put you on the right track:

https://help.qlik.com/en-US/cloud-services/Subsystems/Hub/Content/Sense_Hub/LoadData/use-QVD-files-i...

Regards,
Brett

To help users find verified answers, please do not forget to use the "Accept as Solution" button on any post(s) that helped you resolve your problem or question.
I now work a compressed schedule, Tuesday, Wednesday and Thursday, so those will be the days I will reply to any follow-up posts.
aytac
Contributor
Contributor
Author

Thank you and how can I create rest api connection dynamically in the load script? I need to change the url everyday.
Levi_Turner
Employee
Employee

As I understand the question, you're after passing a variable into a URL in a REST Connection which accepts a param of a date.

With that understanding, I believe the WITH CONNECTION capability of the REST Connector is what you're after. With your example this would be done like so:

// Parse current date

vDate = Date(Now(), 'YYYYMMDD');

LIB CONNECT TO 'My ConnectionName';

RestConnectorMasterTable:
SQL SELECT 
 ...
FROM JSON (wrap on) "root" PK "__KEY_root"
WITH CONNECTION(
    URL "https://api.xxx.com/{channel_id}/results?access_key={project access_key}&date=$(vDate)"
);