[ngw] GW2014 REST-API and PowerShell - sorry for the spam - delete this, testing some code

James Taylor James.Taylor at eastcobbgroup.com
Wed Feb 25 17:52:22 UTC 2015


ghjkl 
 

James Taylor
678-697-9420
james.taylor at eastcobbgroup.com



>>> "Morris Blackham" <mblackham at gw.novell.com> 2/25/2015 11:42 AM >>>

asdf

>>> "Barth Uwe" <Uwe.Barth at stadt-chemnitz.de> 2/25/2015 2:01 AM >>>
Hello,

actually I try to use PowerShell v4 for some GroupWise administration
tasks via REST-API. Unfortunately I'm unable to send a simple
Invoke-RestMethod command like this:

<code>
$uri = "https://grpwise.example.com:9710/gwadmin-service"
$gwuser = "johndoe"
$gwpwd = "johndoespassword"
$gwdom = "gwdom"
$gwpo = "gwpo"
$gwfid = "3qq"
$uri += "/domains/" + $gwdom +"/postoffices/" + $gwpo +
"/users?fileId=" + $gwfid
$encoded =
[System.Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes($gwuser+":"+$gwpwd
))
$headers = @{Authorization = "Basic "+$encoded}
Invoke-RestMethod -Uri $uri -Headers $headers -Method GET -Verbose 
</code>

I always get an error like this:

<error>C:\> C:\gwhelper\gwrest.ps1
https://grpwise.example.com:9710/gwadmin-service/domains/gwdom/postoffices/gwpo/users?fileId=3qq

AUSFÜHRLICH: GET
https://grpwise.example.com:9710/gwadmin-service/domains/gwdom/postoffices/gwpo/users?fileId=3qq
with 0-byte payload
Invoke-RestMethod : The underlying connection was closed: An
unexpected
error occurred on a send.
In  C:\gwhelper\gwrest.ps1:23 Zeichen:1
+ Invoke-RestMethod -Uri $uri -Headers $headers -Method GET -Verbose
+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo 		 : InvalidOperation:
(System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod],
WebException
    + FullyQualifiedErrorId :
WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
</error>

The resulting uri is correct (tested with browser). CA-Certificate is
imported in Windows CertStore. Before the import I got a clear SSL
certificate error message for this.

Does someone here use PowerShell v4 with Invoke-RestMethod
successfully?

Uwe

_______________________________________________
ngw mailing list
ngw at ngwlist.com
http://ngwlist.com/mailman/listinfo/ngw



More information about the ngw mailing list