r/PowerShell • • May 29 '26

Solved Invoke-WebRequest to call the reddit api suddenly broken

Been running a script forever without issue. You don't need OAuth2 to grab the last 100 comments of a user like this:

https://api.reddit.com/user/spez.json?limit=100&after=

or

https://www.reddit.com/user/spez.json?limit=100&after=

A few months ago I added the -UseBasicParsing tag.

Today I'm getting

+ CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

My line of code is $response = Invoke-WebRequest -UseBasicParsing $url | ConvertFrom-Json where $url looks like the https lines above.

Can anyone shed light, please? Thanks.

25 Upvotes

11 comments sorted by

View all comments

Show parent comment

5

u/420GB May 29 '26

curl is, yes, that's why you have to use curl.exe which is the program. That's why I said curl.exe in my comment.