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=http://www.jonathanmedd.net/2012/10/powershell-v3-new-in-operator.html"

$vExpertMe

and specifically to access the short URL:


$vExpertMe.shorturl

vExpertMe

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.

4 thoughts on “Using PowerShell to access the vExpert.me URL Shortener

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>