api freeradius /api/freeradius/user/searchUser
I made a script on owershell to add users to the freeradius database, but no matter how I reworked it, an error comes out: @{result=failed}
with api $url = “$Server/api/freeradius/user/searchUser” everything works.
$Creds = [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("$($ApiKey):$($ApiSecret)")) $url = "$Server/api/freeradius/user/addUser"
$userData = @{ users = @( @{ enabled = "1" username = "67:89:40:a7:42:84" password = "67:89:40:a7:42:84" passwordencryption = "Cleartext-Password" description = "API user addition" ip = "192.168.1.100" } ) }
try { $response = Invoke-RestMethod -Uri $url -Method Post -Headers @{ Authorization = "Basic $Creds" } -Body ($userData | ConvertTo-Json) -ContentType "application/json" Write-Host $response } catch { Write-Host "Error: $($.Exception.Message)" if ($.Exception.Response) { $reader = New-Object System.IO.StreamReader($_.Exception.Response.GetResponseStream()) $responseBody = $reader.ReadToEnd() Write-Host "Server response: $responseBody" } else { Write-Host "Failed to get a server response" } }
Thank you for creating an issue. Since the ticket doesn't seem to be using one of our templates, we're marking this issue as low priority until further notice.
For more information about the policies for this repository, please read https://github.com/opnsense/plugins/blob/master/CONTRIBUTING.md for further details.
The easiest option to gain traction is to close this ticket and open a new one using one of our templates.
This issue has been automatically timed-out (after 180 days of inactivity).
For more information about the policies for this repository, please read https://github.com/opnsense/plugins/blob/master/CONTRIBUTING.md for further details.
If someone wants to step up and work on this issue, just let us know, so we can reopen the issue and assign an owner to it.