I’m building a plugin that will import some data from a third-party API. It will import about 1000 records. The API can only return 250 records per call. Each call gives a nextLink object that sets the next url to call.
For example, if the first call is https://apiurl.com/reso/odata/Property?$count=true&$top=250&$expand=Media&$skip=250" then the response includes “@odata.nextLink”: “https://apiurl.com/reso/odata/Property?$count=true&$top=250&$expand=Media&$skip=250” to indicate the next url to call to get the next bath of records.
$top indicates how many records to return at once, and $skip indicates how many records to skip over.
If no @odata.nextLink is returned, that means you’ve paginated through all the records.
What would the function look like to keep making Curl calls until they’ve all been imported?