6806768

Create New user using Powershell

Discussion created by 6806768 on Apr 7, 2016
Latest reply on Apr 7, 2016 by Ramon Geertjens
When trying to create a new user using powershell and the API i constantly get a 400 bad request Error. Can someone show me what is going wrong?

Below is the script that i use :

$uri = "https://api.samanage.com/users.xml"
$headers = @{"Accept"="application/vnd.samanage.v1.1+xml"}
$xmlcontent = "text/xml"

$email = "p.puk@test.com"
$xmlfile = [xml] @"

p.puk@test.com
piet puk

"@

Invoke-WebRequest -Uri $uri -Body $xmlfile -Credential $credentials -Method Post -ContentType $xmlcontent  -Headers $headers

Outcomes