Forum Discussion
iControl API request fails with HTTP-400 error. How do I diagnose the cause of failure?
I am writing a PowerShell script to query the status of a pool in our F5 load balancer:
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
$request = [System.Net.WebRequest]::Create("https://{0}/iControl/iControlPortal.cgi" -f "xxx.xxx.xxx.xxx")
$request.Method = "POST"
$request.Credentials = new-object System.Net.NetworkCredential @("*********", "*********")
$request.Proxy = new-object System.Net.WebProxy @("xxx.xxx.xxx.xxx", xxxx)
$payload = '{0}' -f "pool-1"
$requestPayloadWriter = new-object System.IO.StreamWriter $request.GetRequestStream()
$requestPayloadWriter.Write($payload)
$requestPayloadWriter.Close()
$request.GetResponse()
$responsePayloadReader = new-object System.IO.StreamReader $request.GetResponse().GetResponseStream()
$pool_status = $responsePayloadReader.ReadToEnd()
$responsePayloadReader.Close()
This works successfully when I run it on my machine, but fails with HTTP-400 error when I run it from our TeamCity build agent. The only difference I am aware of is TeamCity agent has to go through a Squid proxy - my machine does not.
I have verified F5 management console IP address is in the proxy whitelist. My suspicion is the proxy modifies request headers/payload somehow, but I don't know how to verify this.
Is there a log I can view via the Management Console that would give me diagnostic info on attempted API requests?
1 Reply
- Arnold_Zokas_13
Nimbostratus
Payload is actually: my-pool
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com