Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
fevizcaino
Partner - Contributor II
Partner - Contributor II

tRest - Dynamic URLs and using data from input

Hi everyone,

Keep in mind that I`m a super beginner. So feel free to let me know if any part of my process could be done differently as well.

I have a file with a list of endpoints and filenames (highlighted), and I`m using the tRest to go over all the Endpoints, download a list of JSON files, and output each file as a JSON file.

My problem is that my filename comes from the input file, and I have no idea how to bring this information to the tRest output.

fevizcaino_0-1720209290326.png

I looked everywhere and saw some posts talking about using a tmap, but couldn`t grasp the idea. My tRest response has only the body and nothing else.

Thank you.

Best,

Fernando

 

 

 

Labels (2)
1 Solution

Accepted Solutions
Shicong_Hong
Employee
Employee

If you read the endpoints and filenames from the file and use a tFlowToterate to iterate each row, you can access the current row using the following expression:

rowNumber.columnName

eg:

tFileInputDelimited--main(row1)--tFlowToIterate--tRest--main--tFileOutputDelimited

on tRest, you can set a dynamic URL:

"host/"+row1.Endpoint

on tFileOutputDelimited, set a dynamic Output file path:

"D:\path\"+row1.Output+".json"

 

View solution in original post

4 Replies
Shicong_Hong
Employee
Employee

Hello  

Where do you extract the endpoints? from a file with filename?

Shicong_Hong_0-1720404815894.png

Can you explain how endpoint and filename are related? That is, which filename should be used for the current endpoint's output?

Regards

Shicong

fevizcaino
Partner - Contributor II
Partner - Contributor II
Author

Hi,

The highlighted input file looks like this:

fevizcaino_0-1720446933224.png

I`m using this file to manage all endpoints and also to have all filenames (Output). All endpoints return a JSON and I want to save each JSON to a different file.

 

Best,

Fernando Vizcaino

Shicong_Hong
Employee
Employee

If you read the endpoints and filenames from the file and use a tFlowToterate to iterate each row, you can access the current row using the following expression:

rowNumber.columnName

eg:

tFileInputDelimited--main(row1)--tFlowToIterate--tRest--main--tFileOutputDelimited

on tRest, you can set a dynamic URL:

"host/"+row1.Endpoint

on tFileOutputDelimited, set a dynamic Output file path:

"D:\path\"+row1.Output+".json"

 

fevizcaino
Partner - Contributor II
Partner - Contributor II
Author

Thank you!! 

While I was waiting for a reply, I developed another solution and you wouldn`t believe the number of components I used for that. 😂

Only so I can understand clearly these variables from the FlowToIterate. I can use them wherever I want downstream after the Flowtoiterate, right? Even if I turn on the parallel execution?

 

Best,

Fernando Vizcaino