Forum Discussion
iControl REST API Pool Member disable
- Feb 12, 2024
also FYI...if you get a working postman sample, you can click the </> icon and find samples in a lot of tools/languages of that specific query.
And the python sample they shared from my working postman PATCH is:
import requests import json url = "https://ltm15/mgmt/tm/ltm/pool/~Common~nginx-pool/members/~Common~172.16.102.5:80" payload = json.dumps({ "session": "user-disabled", "state": "user-down" }) headers = { 'Content-Type': 'application/json', 'Authorization': 'Basic notsofastmyfriends', 'Cookie': 'BIGIPAuthCookie=supersecretpassphrasehere; BIGIPAuthUsernameCookie=admin' } response = requests.request("PATCH", url, headers=headers, data=payload) print(response.text)
you need to format your python dictionary as json...
json.dumps({"session": "user-disabled"})
also FYI...if you get a working postman sample, you can click the </> icon and find samples in a lot of tools/languages of that specific query.
And the python sample they shared from my working postman PATCH is:
import requests
import json
url = "https://ltm15/mgmt/tm/ltm/pool/~Common~nginx-pool/members/~Common~172.16.102.5:80"
payload = json.dumps({
"session": "user-disabled",
"state": "user-down"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Basic notsofastmyfriends',
'Cookie': 'BIGIPAuthCookie=supersecretpassphrasehere; BIGIPAuthUsernameCookie=admin'
}
response = requests.request("PATCH", url, headers=headers, data=payload)
print(response.text)
- whispererFeb 13, 2024MVP
Make sure you set those headers as mentioned. It gets pissy if you dont give it content-type!
- ashkFeb 13, 2024Cirrus
ah, thank you for this, I tried the same and seems working now calling json.dumps. Also, my initial method is PATCH - PATCH, now I changed it to POST - PATCH.
PostMan Payload do work to copy the exact text. :)Cheers.!!
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