Problems with splitting the result set

Hello Community,
I use the http module to get a response from the hrworks api.
and in general this works.
But they split the result to (in this case) 3 result pages.
In my api response i get the result from the first page back.
But of course i want to have the whole results.
In the header they mention the other 2 results but i dont know how to do go on.

Screenshot

I added an image
Any help is welcome
Thorsten

You want to setup page/limit of results(entry) in url parameter in http module
More help
Best Regards
Pro_tanvee

1 Like

Hallo Pro_Tanvee
I shall setup the page limit? How can i do that?

U need to add “page” at string parameter.

1 Like

Hi @ThorstenO,

If you can extract the number after “page=” where rel=“last” then you will know how many pages of data there are to go through. In this case it’s the 3.

Use a repeater that starts at 1 and ends at the number (in this case, 3).
After the Repeater, use your HTTP Request, but in the URL, append a “&page=i” where “i” is the output from the repeater.
The repeater will run the HTTP Module three times, with these URLs:
https://api.hrworks.de/v2/absences/accumulated-values/?beginDate=2023-06-24&endDate=2023-07-01&page=1
https://api.hrworks.de/v2/absences/accumulated-values/?beginDate=2023-06-24&endDate=2023-07-01&page=2
https://api.hrworks.de/v2/absences/accumulated-values/?beginDate=2023-06-24&endDate=2023-07-01&page=3

After the repeater, do your normal actions, or put an aggregator in there to aggregate all the results before passing them on to the next module.

3 Likes

Hey Donald…ok ok thank you. Now i get it:-)
But the problem is: The number of result pages can change based on the number of results…Must i added the maxium number of http modules like do 20 and than “hope” it will be enough?

Hello,
No you run the HTTP module once like you are now, then extract the number of pages from the value of “link” from the Header. For extracting that number you could use Regular Express match from the Tools.
Then, you run the HTTP Modules again after a repeater.

1 Like

Here I have set a variable to mimic the output from your HTTP module

After HTTP, we run a Text Parser - Match Pattern module and extract the page number where rel=last. There are many different ways to handle this, this is just one way:
You can see the 3 was extracted

Here is what the settings on the Text Parser look like

Then, we use a repeater with the extracted value.

The results of the repeater is one bundle for each time it repeats, in this case, 3.
image

Whatever module you put after the repeater will run once for each of the Repeater’s output bundles.
If you put an HTTP module after repeater, the HTTP module will run 3 times.
If you have the bundle’s value of " i " in the HTTP module, each time it runs, i will be 1 the first time, 2 the second time, and 3 the third time.

I have included the blueprint for this if you want to check it out.
Blueprint-TextParser-Repeater.json (6.2 KB)

3 Likes

Hi Donald, thank you so much. The steips you mentioned worked! Could you help me further? I now have 3 (or more) bundels as output.


But i cant directly access them right? Do i have to go over the array aggregator?
But that module just make 3 array of the 3 bundels and not one array or collection…

If you’ve got a Repeater, then an HTTP Module, you could then put an Array Aggregator and stack parts of the results you want from each time the HTTP Module runs into a big array.

You could also use a text aggregator instead and just put everything in a big text string.

Really depends how you are using the information.

3 Likes