Using PowerShell to access the vExpert.me URL Shortener
Darren Wollard set up a very cool vExpert.me URL shortener for vExperts to use. I was curious whether this was available programmatically and turns out it is with a simple URL query. You either need to supply your username and password in the query (bad) or secret code (less bad– tip: find it on the tools page after logging in to the admin site) . Then the query from PowerShell is as simple as
$vExpertMe = Invoke-RestMethod -Uri "http://vexpert.me/yourls-api.php?signature=secretcode&action=shorturl&format=json&url=https://www.jonathanmedd.net/2012/10/powershell-v3-new-in-operator.html"
$vExpertMe
and specifically to access the short URL:
$vExpertMe.shorturl
Note: Be careful of the password you choose if you go down the username and password route to query the YOURLS API. It appears to not like special characters in the password. Thanks to Darren for helping me troubleshoot that.