Skip to content

Get-LMDeviceData doesn't handle paging correctly #79

@migrande

Description

@migrande

When using the Get-LMDeviceData to retrieve a large number of results, the API returns "nextPageParams" as the logic for paging to get the next set of results. However, the Get-LMDeviceData function is relying on the Total field in the response to calculate and manage the paging. From my testing, the Total field isn't even being returned by the API, and so it never attempts to page.

Further, the paging logic in the script is adding the "$Response.Items" result to the $Results variable to add the current set of results to the larger, multi-page set. However, the API is also not returning an Items property, and instead just returns the values and time properties directly at the root. The logic further down in this function uses those properties on the $Response variable directly and completely ignores the $Results variable anyways.

I'm on version 7.7.4 of the PS Module and using a Bearer token for auth (if that matters)

This is reproducible when I query for 24 hours of data on a datasource which polls every minute.

Is there a fix or some version issue that would address this? In the short-term, I've resorted to smaller timeframes when using Get-LMDeviceData.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions