Are you interested in our Early Access Program (EAP)? This program allows you to preview code, test in your lab and provide feedback prior to General Availability (GA) release of all Infoblox products. If so, please click the link here.

API Examples


POST command stopped working

Posts: 7
885     0

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 = @{
#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.




Re: POST command stopped working

Posts: 7
886     0

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.

Showing results for 
Search instead for 
Did you mean: 

Recommended for You