Since iControl REST is the new kid on the block, it's bound to start getting some of the same questions we've addressed with traditional iControl. One of these oft-asked and misunderstood questions is about enabling/disabling pool members. The original poster in this case is actually facing a syntax issue with the allowable state issues in the json payload, but I figured I'd kill two birds with one stone here and address both concerns going forward.

DevCentral member Rudi posted in Q&A asking for some assistance with disabling a pool member. He was able to change some properties on the pool member, but trying to change the state resulted in this error:

 

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

 

The REST interface is complaining about an invalid property, mainline, the "up" state. If you do a query against an "up" pool member, you can see that the state is "unchecked" instead of up.

 

{
  "state": "unchecked",
  "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-enabled"
}

 

You might also note the session keyword in the pool member attributes as well. This is the key that controls the forced offline behavior. The mappings for these two values (state and session) to the GUI state of a pool member are as follows

GUI: Enabled
{"state": "unchecked", "session": "user-enabled"}
GUI: Disabled
{"state": "unchecked", "session": "user-disabled"}
GUI: Forced Offline
{"state": "user-down", "session": "user-disabled"}

 

So to change a value on a pool member, you need to use the PUT method, and specify in the URL the pool, pool name, and the pool member:

 

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"}'

 

This results in changed state and session for this pool member:

 

{
  "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"
}

 

Best tip I can give with discovering the nuances of iControl REST is to query existing objects, and change their default values around in the GUI and re-query to see what the values are supposed to be. Happy coding!