Learn F5 Technologies, Get Answers & Share Community Solutions Join DevCentral

Filter by:
  • Solution
  • Technology
Answers

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

0
Rate this Question

Answers to this Question

placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

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

1
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

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"}]
0
Comments on this Answer
Comment made 13-Sep-2017 by Zane B 13

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.

0
Comment made 13-Sep-2017 by Kevin.K

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

0
Comment made 14-Sep-2017 by Zane B 13

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!

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

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

0
placeholder+image
USER ACCEPTED ANSWER & F5 ACCEPTED ANSWER

Hello Zane, Pool members are a sub-collection under the pool resource. To make changes to sub-collections refer to this article:

https://devcentral.f5.com/articles/demystifying-icontrol-rest-part-2-understanding-sub-collections-and-how-to-use-them

0