Friday, May 8, 2020

Testing REST API using Invoke-RestMethod in PowerShell

cURL seems to be the standard for casual testing of Web Services endpoints.  I've been stuck with a Windows laptop lately for a client Salesforce project, and cURL (and Salesforce Workbench for that matter) can be flaky to deal with, esp in a security environment that's tightly controlled by Group Policy.  Then I discovered Invoke-RestMethod.  It's a nify little cmdlet available since PowerShell 3.0.

My first task was to download an event log file, and as a complete newbie, I was done in 5 minutes with my 250 MB file in hand, no installation required!  Here's how it looked like


The cmdlet has a ton of options, so I'm sure I'll be back to it a lot as long as I keep working on Windows with Salesforce REST APIs...

No comments:

Post a Comment