I'm trying API Rest method with Symantec EndPoint Manager 14 (14.0.3876.1100)
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = { $True }
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
$cred= @{
username = "myaccount"
password = "mypassword"
domain = ""
}
#converts $cred array to json to send to the SEPM
$auth = $cred | ConvertTo-Json
$access_token = $Authent.Token
#Lists All groups
#Creates NewGroup
Invoke-RestMethod -Method Post -Uri https://mySEPM:8446/sepm/api/v1/groups -ContentType "application/json" -Headers @{Authorization='Bearer '+$access_token} -Body @{Groupid = "E7CE611599EF43D34050E441973EE6A7";Name = "NewGroup";Description = "NewGroup_description";inherits = "True"}
Method Get returns an array with properties of each groups (ID, name, description, ....)
I want to create a new group "NewGroup" under a group with ID "E7CE611599EF43D34050E441973EE6A7"
Method Post returns an error 500
Invoke-RestMethod : The remote server returned an error: (500) Internal Server Error.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-RestMethod], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeRestMethodCommand
I think there is an error in body section.
Someone knows the good syntax for this ?
Thank you in advance.