Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in Invoke-vRARestMethod auto-pagination handling when fetching policies #285

Open
tocano33 opened this issue Nov 13, 2022 · 0 comments

Comments

@tocano33
Copy link

Steps to reproduce

$response = Invoke-vRARestMethod -Method GET -Uri "/policy/api/policies"

Expected behavior

Return the first page of policies - or, ideally, cycle through all pages and return all the policies

Actual behavior

Gets stuck in infinite loop fetching data.

I believe this is because the /policy/api/policies endpoint returns the standard paginated portion of the payload, including the property 'last' which is used by Invoke-vRARestMethod to identify paginated data and auto-request the next page by using the 'page' parameter. Except that the /policy/api/policies endpoint appears to ignore the 'page' parameter (using $skip and $top instead), so it continually returns the same set of results and so 'last' is never reached.

Environment data

> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      7.2.7
PSEdition                      Core
GitCommitId                    7.2.7
OS                             Microsoft Windows 10.0.17763
Platform                       Win32NT
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

> $vRAConnection
Server             : https://[FQDN]
Token              : eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImtpZCI6IjEwMTcwNjYzODc5MTk4NDA1NzcxIn0...K7ZYqD8jPfTqubk5080wklQJ6SvqNCjLFUe08GsWA
RefreshToken       : Ap1X0X...4V9ibSBK
APIVersion         : 2021-07-15
SignedCertificates : True
SslProtocol        : Default

> (Get-Module PowervRA).Version

Major  Minor  Build  Revision
-----  -----  -----  --------
5      2      0      -1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant