Working on the API and I am able to get data, delete users, but when I attempt to update data via the PUT method it comes back with a 404 error...the json body looks good { "user": { "group": "dummygroup" } } but I am doing this with invoke-webrequest with powershell (which I am able to do with other JSON sites and also snag data above) $pair = "$($apikey):$($pass)" $bytes = [System.Text.Encoding]::ASCII.GetBytes($pair) $base64 = [System.Convert]::ToBase64String($bytes) $basicAuthValue = "Basic $base64" $headers = @{'Authorization'=$basicAuthValue} $Website = "https://serverFQDN/admin/users/$userID" (which is legit info from the array, works for grabbing data) $UpdateGroup = [ordered]@{ "user"=[ordered]@{ "group"="dummygroup"; } } $UpdateGroup = $UpdateGroup | ConvertTo-Json Invoke-WebRequest -Uri $TempWebsite -Headers $headers -Body $UpdateGroup -ContentType 'application/json' -Method put thoughts????
Interesting, expect the group which should be updated, can you please try to add there some another attribute like the email address in to the request together with the group. The email just place there don't have to be changed. {"user": { "email": "user@domain.com", "group": "external-users" } }
Thanks for this! I was also trying to change a user's group from localusers to another-group. For the world of me, it wouldn't let me do so, if the only attribute I was changing was the group. But I added another attribute (email) and set it to what it's already set to, and it works fine. I can change other attributes (eg: strong_auth_username) by itself, but for some reason, the group attribute seems to only be changeable if some other attribute is being changed. To me that seems like a bug (or at least missing in the docs) that some attributes are change-able by themselves while others are not. Glad I found this thread, thanks again, PH