Skip to content

Instantly share code, notes, and snippets.

@altrive
Last active January 30, 2018 21:31
Show Gist options
  • Save altrive/6487508 to your computer and use it in GitHub Desktop.
Save altrive/6487508 to your computer and use it in GitHub Desktop.
When query RSS/ATOM/ODATA xml data souce by using Invoke-RestMethod cmdlet. returned only about half of items.

Summary

When query RSS/ATOM/ODATA xml data souce by using Invoke-RestMethod cmdlet. returned only about half of items.

Test Code

$requestUrl = "http://blogs.msdn.com/b/powershell/rss.aspx"

#Query by Invoke-WebRequest
[string[]]$results = ([xml](Invoke-WebRequest -uri $requestUrl)).rss.channel.item | select -ExpandProperty Title
Write-Host ("Query by Invoke-WebRequest : {0} items" -f $results.Count)

#Query by Invoke-RestMethod
[string[]]$results = Invoke-RestMethod -Uri $requestUrl | select -ExpandProperty Title
Write-Host ("Query by Invoke-RestMethod : {0} items" -f $results.Count)

References

@derek-baker
Copy link

I'm noticing something similar with OData and [System.Net.WebRequest]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment