- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
POST command stopped working
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-23-2022 10:33 PM
Hi all,
$pwd = ConvertTo-SecureString "XX" -AsPlainText -Force $creds = New-Object Management.Automation.PSCredential ('XX', $pwd) $uri = "https://XX.XX.XX.XX/wapi/v2.4/network/ZG5zLm5ldHdvcmskMTcyLjE2LjIxNC4wLzI0LzA:XXX.XX.XXX.X/24/default?_function=next_available_ip" $host_details = @{ num=1 } #convert to json format $body = $host_details | ConvertTo-Json Write-Host $body $response2 = Invoke-WebRequest -Uri $uri -Method POST -Credential $creds -ContentType 'application/json' -Body $body -UseBasicParsing Write-Host $response2
I am using the above code, it was working fine earlier then it suddenly stopped working and gave an error
Invoke-WebRequest : The remote server returned an error: (400) Bad Request.
At C:\XXXXX\pl code.ps1:45 char:14
+ ... response2 = Invoke-WebRequest -Uri $uri -Method POST -Credential $cre ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebException
+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
I have even tried
$url1 = "https://XX.XX.XX.XX/wapi/v2.4/fixedaddress"
same error [it was working earlier].
But all my "GET" commands are working only issue with my "POST" commands.
Thanks
Re: POST command stopped working
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2022 10:08 PM
The above user is subnet user with restricted permission with which it was working, then a admin user was created and everything stopped working.
So can creation of new user cause this issue.
Thanks in advance.