Forum Discussion

ashk's avatar
ashk
Icon for Cirrus rankCirrus
Feb 12, 2024
Solved

iControl REST API Pool Member disable

Hello Everyone,    Iam working on an script to disable the pool members but seems we are getting issues, I tried multiple types but still its not working. Could someone review the below and quote m...
  • JRahm's avatar
    JRahm
    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)