However, you don't know how many pages there are, hence, the API call needs to stop when the API call doesn't return any records.
Therefore, for the API call i need to create a loop where the pagenumber is 'x', and the call needs to stop when the call returns with 0 records. Till then the API call need to extract data and place it in a table.
I simply don't know how to write this, can someone help me with this?
The offset value should be returned on the GET call and you can use this in your loop to return the next page's records. The trick you need to apply in your loop is that when the offset value is null, it means that there are no more pages after the current load, which means you need to end the loop after that iteration,
Have a look at the example I'm pasting, maybe this can be off some help for you to apply the same logic to your script, you will see that after every loop I write out a qvd with the loop iteration (variable i) as the suffix. After you finish the loop process, you simply LOAD * all the qvd's to get all the data in the same table. Note that I never do more than 11 iterations, but you can change the for i = 0 to 100000000 if you need to
Hope this helped a bit to steer you in the right direction
From the documentation I see that Eloqua's offset might work different, using for example 1000 to indicate retrieving records 1000 to 1999, maybe you can change the logic a bit to say that if no data is retrieved or if the actual nr of records retrieved is less than the limit parameter nr of records, then exit the loop