i don't think so . the api is for web. if we modify some field, on the web, we can't finger out which is the newer data. maybe can do??it's not easy to controll on web js , we should carry all unit data to server. maybe post/get is helpful and easy to understand. in enterprise apps , put and patch method is forbiden ,which for safety reasons??
THANKS coosloul, apache APISIX ------------------ ???????? ------------------ ??????: "Zhiyuan Ju"<[email protected]>; ????????: 2019??11??6??(??????) ????11:09 ??????: "dev"<[email protected]>; ????: Re: [DISCUSS] How to add a single upstream node to the upstream list via the Admin API? I agree with YuanSheng, if we want to update some target fields, it's better to use the PATCH method, then we can design the URI format more RESTful. Best Regards! @ Zhiyuan Ju <https://www.shaoyaoju.org/> Ming Wen <[email protected]> ??2019??11??6?????? ????11:06?????? > PATCH + `nodes?merge=partial` also needs to deal with duplicate nodes. > `merge=partial` is hardly understandable for me. > > Thanks, > Ming Wen, Apache APISIX > Twitter: _WenMing > > > YuanSheng Wang <[email protected]> ??2019??11??6?????? ????11:00?????? > > > On Wed, Nov 6, 2019 at 10:54 AM Ming Wen <[email protected]> wrote: > > > > > how about POST + `nodes/node`, like this: > > > curl http://****/apisix/admin/upstreams/1/nodes/node -X POST \ > > > -d '{"127.0.0.1:8081":3}' > > > > > > > The POST method usually means inserting things, and if there is the same > > item in the existing node list, it should not be inserted again. > > > > That's why I finally choose the PATCH method. > > > > > > > > > > and we can remove one node easier. > > > > > > Thanks, > > > Ming Wen, Apache APISIX > > > Twitter: _WenMing > > > > > > > > > YuanSheng Wang <[email protected]> ??2019??11??6?????? ????10:14?????? > > > > > > > Hi: > > > > > > > > For the upstream node list, we should allow new nodes to be added to > it > > > via > > > > Admin API. > > > > Users only need to provide new node information. > > > > > > > > I think we can use PATCH + uri, with an extra parameter to indicate > the > > > > data merge method: full replacement or partial modification. > > > > > > > > Here is an example: > > > > > > > > *Old data:* > > > > > > > > { > > > > "nodes": { > > > > "127.0.0.1:8080": 1 > > > > }, > > > > "type": "roundrobin", > > > > "desc": "new upstream" > > > > } > > > > > > > > *Add new node:* > > > > > > > > curl http://****/apisix/admin/upstreams/1/nodes?merge=partial -X > > > > PATCH \ > > > > -d '{"127.0.0.1:8081":3}' > > > > > > > > *Current data:* > > > > > > > > { > > > > "nodes": { > > > > "127.0.0.1:8080": 1, > > > > "127.0.0.1:8081": 3 > > > > }, > > > > "type": "roundrobin", > > > > "desc": "new upstream" > > > > } > > > > > > > > > > > > -- > > > > *MembPhis* > > > > My github: https://github.com/membphis > > > > Apache APISIX: https://github.com/apache/incubator-apisix > > > > > > > > > > > > > -- > > > > *MembPhis* > > My github: https://github.com/membphis > > Apache APISIX: https://github.com/apache/incubator-apisix > > > ========================================================= ???? ??????????http://rmzdb.iteye.com ????????????????????????:??????????????????????????????????????,??????????????????????! =========================================================
