Hi Guys,
I'm trying to use RestSharp from PowerShell and I'm struggling when it
comes to POSTing data.
I've this script here, which uses the GET method and works ok (I've
replaced the Tumblr account details with xxxxx):
#######################################
# Attempt one point five with RestSharp - authentication test
#######################################
add-type -Path RestSharp.dll
$client = "
http://xxxxxxxx.tumblr.com"
$request = "api/authenticate"
#$r = New-Object RestSharp.RestRequest($request, "POST")
$r = New-Object RestSharp.RestRequest($request) # this
authenticates...
$c = New-Object RestSharp.RestClient($client)
[Void] $r.AddParameter("email", "xxxxxxx")
[Void] $r.AddParameter("password", "xxxxxx")
$rr = $c.Execute($r)
$rr
If i switch from a GET to a POST (I need to for writing to the Tumblr
API) I get an authentication error. I wonder if it is related to the
encoding of data...?
these are the lines to swap over to switch from a GET to a POST:
$r = New-Object RestSharp.RestRequest($request, "POST")
#$r = New-Object RestSharp.RestRequest($request) # this auth
Has anybody similar experience with PowerShell or C#?
Thanks for any feedback,
Matt