Forum Discussion

Rudi_95802's avatar
Rudi_95802
Icon for Nimbostratus rankNimbostratus
Jun 06, 2014

How do I enable and disable pool members using iControlREST

Hi

I'm trying to the following PUT request to enable a pool member (IP's masked out):

https://10.102.xx.xx/mgmt/tm/ltm/pool/~QA~pool_vcoza_portal_UAT/members/~QA~10.102.xx.xx:9001

My request has the following body and Content-Type: application/json

{ "state" : "up" }

I get the following result back:

{"code":400,"message":"invalid property value \"state\":\"up\"","errorStack":[]}

However, doing the same kind of thing for other properties, dynamicRatio for example, does work.

Please help!

  •  

    curl -sk -u admin:admin 
    https://192.168.6.5/mgmt/tm/ltm/pool/testpool/members/~Common~192.168.101.11:8000/ 
    -H "Content-Type: application/json" -X PUT 
    -d '{"state": "user-down", "session": "user-disabled"}'
    
    {"state": "user-down", "session": "user-disabled"} (Member Forced Offline in GUI)
    {"state": "unchecked", "session": "user-disabled"} (Member Disabled in GUI)
    {"state": "unchecked", "session": "user-enabled"}  (Member Enabled in GUI)
    

     

  •  

    jrahm@ubuntu:/var/tmp$ curl -sk -u admin:admin https://192.168.6.5/mgmt/tm/ltm/pool/testpool/members/~Common~192.168.101.11:8000/ | jq .
    {
      "state": "user-down",
      "connectionLimit": 0,
      "address": "192.168.101.11",
      "selfLink": "https://localhost/mgmt/tm/ltm/pool/testpool/members/~Common~192.168.101.11:8000?ver=11.5.1",
      "generation": 63,
      "fullPath": "/Common/192.168.101.11:8000",
      "partition": "Common",
      "name": "192.168.101.11:8000",
      "kind": "tm:ltm:pool:members:membersstate",
      "dynamicRatio": 1,
      "inheritProfile": "enabled",
      "logging": "disabled",
      "monitor": "default",
      "priorityGroup": 0,
      "rateLimit": "disabled",
      "ratio": 1,
      "session": "user-disabled"
    }
    

     

  • I tried this but getting the following error. {"code":415,"message":"Found invalid content-type. The content-type must be application/json. The received content-type is application/x-www-form-urlencoded","errorStack":[]}

     

    • JRahm's avatar
      JRahm
      Icon for Admin rankAdmin
      don't forget this part of the query: -H "Content-Type: application/json"
    • Kapil_Malhotra_'s avatar
      Kapil_Malhotra_
      Icon for Nimbostratus rankNimbostratus
      Hi Jason, -H "Content-Type: application/json was part of my query but still getting the error posted above curl -sk -u kapil:xxxxx https://xxxxxxxx/mgmt/tm/ltm/pool/test-default/members/~Common~10.xx.xx.xx:10001/ \ -H "Content.Type: application/json" -X PUT -d '{"state": "user-down", "session": "user-disabled"}'
    • Romuald_197888's avatar
      Romuald_197888
      Icon for Nimbostratus rankNimbostratus
      Hello, I've got the same error : {"code":400,"message":"Found invalid JSON body in the request.","errorStack":[]} With the following request : curl -sk -u admin:xxxxx -H "Content-Type: application/json" -X PUT -d '{"session": "user-enabled"}' https://xx.xx.xx.xx/mgmt/tm/ltm/pool/~PREPROD~POOL_COLLECTEAI/members/~PREPROD~host.domain.fr:80 Any idea ? Thanks
  • Hello,

     

    Our consultant find the solution. The correct syntax is with PUT method:

     

    curl -X PUT -d '{"session":"user-enabled"}' -u admin:xxxxxxxxx -H "Content-Type: application/json" -k

     

    • JRahm_128324's avatar
      JRahm_128324
      Historic F5 Account
      good deal. Just saw this, sorry I missed the original comment. Yes, a modification of an existing object requires the PUT method, POST is for object creation.