I'm using PowerShell to grab information from a website, which I've been able to do successfully with Invoke-RestMethod.
The website puts it's various options in the URL itself, such as http://www.contoso.com/?opt1=on&opt2=12345
What I'd like to do is create a function to run the Invoke-RestMethod cmdlet, and have a parameter for each option available. The Function would have a parameter for each option available to put in the URL, and then concatenate all the non-null parameters into the URi for the Invoke-RestMethod cmdlet.
Is there an easy way to loop through all the parameters in the function to see which one's are in use, and concatenate them into the full URi without calling every parameter individually?