chocolatey-licensed-issues
chocolatey-licensed-issues copied to clipboard
Central Management Group CreateOrEdit endpoint throwing internal error in 0.12.0 when modifying group membership
What You Are Seeing?
When submitting a request to the CreateOrEdit endpoint and not providing the groups
property in the json payload and error is thrown.
Prior to 0.12.0 you could supply computers, groups, or both and all would work correctly.
What is Expected?
I actually think this behavior is how it should have always happened, but we need to document in the Swagger document and also in our public documentation that these fields are now required.
How Did You Get This To Happen? (Steps to Reproduce)
- Create a WebSession variable
$credential = Get-Credential
$body = @{
usernameOrEmailAddress = $Credential.UserName
password = $Credential.GetNetworkCredential().Password
}
$Result = Invoke-WebRequest -Uri "https://chocoserver.steviecoaster.dev/Account/Login" -Method POST -ContentType 'application/x-www-form-urlencoded' -Body $body -SessionVariable Session -ErrorAction Stop
- Send an API like below, editing for data available in your test environment(s)
$body = @{
id = $Id
name = $ccmGroupName
computers = $computerArray
}
$params = @{
Uri = "https://chocoserver.steviecoaster.dev/api/services/app/Groups/CreateOrEdit"
Method = "POST"
WebSession = $Session
ContentType = 'application/json'
Body = $body | ConvertTo-Json
}
$null = Invoke-RestMethod @params -ErrorAction Stop
System Details
- Operating System: Server 2019
- Windows PowerShell Version: 5.1
- Chocolatey CLI Version: 2.2.2
- Chocolatey Licensed Extension version: 6.0.1
- Chocolatey License type (Professional / Business / ?): Business
- Terminal/Emulator: powershell.exe
Output Log
ccm-website.log
## Workarounds
You can modify the body of the request as follows:
```powershell
$body = @{
id = $Id
name = $ccmGroupName
computers = $computerArray
groups = @()
}
```
## Proposed Solution
Mark all fields required in Swagger documentation
## Related Issues and Tickets
[Zendesk Ticket](https://chocolatey.zendesk.com/agent/tickets/20711)
## Done Checklist
┆Issue is synchronized with this [Gitlab issue](https://gitlab.com/chocolatey/central-management/choco-licensed-management-ui/-/issues/948) by [Unito](https://www.unito.io)