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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
pthomas
Contributor III
Contributor III

How do I iterate through a list

I am trying to build a job that will take a json list of (books: genre, url) and loop through each result to call an api by  passing the url to a tRest component.  The resulting json needs to be saved using the genre as the file name.

I can call individual tRest objects and save the json but I want to make this work in 1 job looping through a list of apis.

 

* The NYTimes apis are free and you can register here ( https://developer.nytimes.com/apis )

* Sorry json that I'm trying to loop through doesn't paste well. 

{
"Books": [
{
"Genre": "Hardcover-Fiction",
"url": "https://api.nytimes.com/svc/books/v3/lists/current/hardcover-fiction.json?api-key=<--secret access key-->"
},
{
"Genre": "Trade-Fiction-Paperback",
"url": "https://api.nytimes.com/svc/books/v3/lists/trade-fiction-paperback?api-key=<--secret access key-->"
},
{
"Genre": "Paperback-Nonfiction",
"url": "https://api.nytimes.com/svc/books/v3/lists/paperback-nonfiction.json?api-key=<--secret access key-->"
}
]
}

 

Labels (3)
1 Solution

Accepted Solutions
Shicong_Hong
Employee
Employee

Hello 

You can use tFlowToIterate to iterate each URL extracted from JSON string and pass the current URL to tRest for next API calling. You can learn how to use tFlowToIterate component and how to access the current URL on tRest by reading this scenario: Transforming data flow to a list.

Let me know if you still have any questions.

Regards

Shicong

View solution in original post

1 Reply
Shicong_Hong
Employee
Employee

Hello 

You can use tFlowToIterate to iterate each URL extracted from JSON string and pass the current URL to tRest for next API calling. You can learn how to use tFlowToIterate component and how to access the current URL on tRest by reading this scenario: Transforming data flow to a list.

Let me know if you still have any questions.

Regards

Shicong