Forum Discussion

Zane_B_332165's avatar
Zane_B_332165
Icon for Nimbostratus rankNimbostratus
Sep 13, 2017

12.1.2: iControlRest, How to add members to pool

According to the documents, it states tot use PATCH and give url of the pool (/mgmt/tm/ltm/pool/~partition~nameOfPool) and essentially pass in the JSON of what to add - in my case it's:

 

{"member":[{"name":"test01","address":"x.x.x%x","partition":"zzz"},{"name":"test02","address":"x.x.x.x%x","partition":"zzz"}]}

 

all information comes directly from using the iControlRest api to get that data, and has worked with other commands (such as creating the pool and nodes).

 

However in trying to add the nodes to the pool, I get the response:

 

Response body: {"code":400,"message":"one or more properties must be specified","errorStack":[],"apiError":26214401}

 

(If needed, I'm using the iControlRest api with VMWare's vRO)

 

Extra Question: Is there a page with error

 

7 Replies

  • Kevin_K_51432's avatar
    Kevin_K_51432
    Historic F5 Account

    Greetings, I use curl to make the call which is of course quite different. The call is:

    curl -k -u admin:admin https://172.24.17.16/mgmt/tm/ltm/pool/~Common~test-pool/members -H "Content-Type: application/json" -X POST -d '{"name":"10.12.23.29:80","address":"10.12.23.29"}'
    

    In comparing the two, I notice the pool portion has both the partition name and the string "members". Then the new member definition, there's simply the "name" and "address".

    Is it possible to adjust your syntax a bit to see if that works?

    /mgmt/tm/ltm/pool/~partition~nameOfPool/members
    
    [{"name":"test01","address":"x.x.x%x","partition":"zzz"},
    {"name":"test02","address":"x.x.x.x%x","partition":"zzz"}]
    
    • Zane_B_332165's avatar
      Zane_B_332165
      Icon for Nimbostratus rankNimbostratus

      Sadly, when I put it in that format the response is:

       

      {"code":400,"message":"Found invalid JSON body in the request. The expected JSON type is object. The received JSON type is array.","errorStack":[],"apiError":1}

       

      It doesn't like it as an array instead of a JSON string.

       

    • Kevin_K_51432's avatar
      Kevin_K_51432
      Historic F5 Account

      Frustrating, I notice in your original you have "member". Have you tried "members"? Really grasping and wishing I know JSON better =(

       

    • Zane_B_332165's avatar
      Zane_B_332165
      Icon for Nimbostratus rankNimbostratus

      Kevin, thank you so much.

       

      It appears that the pdf for 12.1.2 had some errors. It is in fact "members" -- and I'm kinda kicking myself for not thinking to try that.

       

      I'd upvote the comment if I could!

       

  • As to comment from Kevin.K, it is indeed "members" not "member" (in case you're using 12.x.x with the documentation and ran into the same issue).

    So the javascript object should be in this format:

    {"members":[{"name":"test01","address":"x.x.x%x","partition":"zzz"},{"name":"test02","address":"x.x.x.x%x","partition":"zzz"}]}
    
    
    Pointed at: 
    
    /mgmt/ltm/tm/~partition~nameOfPool
    

    This is in thanks to Kevin.K's comments

  • P_K's avatar
    P_K
    Icon for Altostratus rankAltostratus

    Did you try without % for member address?

     

    {"members":[{"name":"test01","address":"x.x.x.x","partition":"zzz"},{"name":"test02","address":"x.x.x.x","partition":"zzz"}]}