Invoke-RestMethod with the -FollowRelLink parameter correctly retrieves additional pages of results from REST services. However, the return is an array of pages rather than one array of all results.
Steps to reproduce
PS /> $apikey = 'MYAPIKEYHERE'
PS /> $headers = @{'Accept'='application/json';'Content-Type'='application/json';'Authorization'="SSWS $apikey"}
PS />
PS /> $users = Invoke-RestMethod -Uri 'https://MYORGNAME.okta.com/api/v1/users/?filter=status eq "ACTIVE"&limit=10' -Method GET -Headers $headers -FollowRelLink -MaximumFollowRelLink 3
PS />
PS /> $users.Count
3
PS /> $users.Item(0).Count
10
PS /> $users.Item(1).Count
10
PS /> $users.Item(2).Count
10
PS />
Expected behavior
Invoke-RestMethod should return a single array of objects instead of an array of arrays (pages).
PS /> $users.Count
30
Actual behavior
Invoke-RestMethod returns an array of arrays (pages).
Environment data
PS /> $PSVersionTable
Name Value
---- -----
PSVersion 6.0.0-rc
PSEdition Core
GitCommitId v6.0.0-rc
OS Linux 4.4.0-43-Microsoft #1-Microsoft Wed Dec 31 14:42:53 PST 2014
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
PS />
Invoke-RestMethod with the -FollowRelLink parameter correctly retrieves additional pages of results from REST services. However, the return is an array of pages rather than one array of all results.
Steps to reproduce
Expected behavior
Actual behavior
Environment data