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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
mks02
Creator
Creator

tRest api query paramaetrized with pages and size


I am calling an API by using tRest component and through that API, json file is getting.
The last rows for json file looks like below:

"totalRecords":250,
"totalPages":25,
"numberOfRecords":10

In tRest, URL segment the value is "api_url + "api/ver41/Student/getModifiedList?pageIndex=1&size=10&GetByDateTime=2019-09-30%0900:00:00.000""

I need to pass this URL as parametrized i.e. to read the file by API call, and then pass "numberOfRecords" and "totalPages" to
size and pageIndex of URL respectively. Number of records/TotalRecords are dynamic, they can be changed.

Attached is the tRest configuration.


Thanks in advance.0683p000009M8fY.png

Labels (4)
3 Replies
amitdadri
Contributor
Contributor

Hi @mks02 ,

If I understand this correctly, then you can

1. take that json output in tExtractJSONFields and can manipulate the data, then

2. take further the output to tFlowToIterate and the iterate the output to the tRest component.

3. In tRest components URL section, you can read the output of tFlowToIterate as Global Variables. eg. (String)globalMap.get("row6.totalRecords")

 

Second way is to use tContextLoad, to pass the URL's dynamically.

 

Hope this helps you!!

 

mks02
Creator
Creator
Author

Hi @amitdadri ,

Thanks for your valuable time. I am calling that api (url) to get that json file. Below is the correct mapping:

tRest --> tFileOutputRaw (to get that file in json format) 
After this step, I can apply your suggestions.

But in tRest URL's section, how could I pass parametrized values for total number of records/page size and currentdate in URL.

 

For tContextLoad, could you please explain in detail.

Thanks.

 

Martintin
Contributor III
Contributor III