I am trying to get data from a REST API which has pagination. I have tried to use the -FollowRelLink
option which is part of Invoke-RestMethod
but the is not working. The API Below returns a maximum of 175 records.
PowerShell:
$Scryfall_Set_Card_Data = Invoke-RestMethod "https://api.scryfall.com/cards/search?order=name&q=in%3AELD" -FollowRelLink
Write-Host $Scryfall_Set_Card_Data.data.Count -ForegroundColor Cyan
Response:
object "list"
total_cards 285
has_more true
next_page "https://api.scryfall.com/cards/search?format=json&include_extras=false&include_multilingual=false&order=name&page=2&q=in%3Aeld&unique=cards"
data […]
The Write-Host...
outputs 175