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



 




------------------ ???????? ------------------
??????:&nbsp;"Zhiyuan Ju"<[email protected]&gt;;
????????:&nbsp;2019??11??6??(??????) ????11:09
??????:&nbsp;"dev"<[email protected]&gt;;

????:&nbsp;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/&gt;


Ming Wen <[email protected]&gt; ??2019??11??6?????? ????11:06??????

&gt; PATCH + `nodes?merge=partial` also needs to deal with duplicate nodes.
&gt; `merge=partial` is hardly understandable for me.
&gt;
&gt; Thanks,
&gt; Ming Wen, Apache APISIX
&gt; Twitter: _WenMing
&gt;
&gt;
&gt; YuanSheng Wang <[email protected]&gt; ??2019??11??6?????? ????11:00??????
&gt;
&gt; &gt; On Wed, Nov 6, 2019 at 10:54 AM Ming Wen <[email protected]&gt; 
wrote:
&gt; &gt;
&gt; &gt; &gt; how about POST + `nodes/node`, like this:
&gt; &gt; &gt; curl http://****/apisix/admin/upstreams/1/nodes/node -X POST \
&gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -d 
'{"127.0.0.1:8081":3}'
&gt; &gt; &gt;
&gt; &gt;
&gt; &gt; The POST method usually means inserting things, and if there is the 
same
&gt; &gt; item in the existing node list, it should not be inserted again.
&gt; &gt;
&gt; &gt; That's why I finally choose the PATCH method.
&gt; &gt;
&gt; &gt;
&gt; &gt; &gt;
&gt; &gt; &gt; and we can remove one node easier.
&gt; &gt; &gt;
&gt; &gt; &gt; Thanks,
&gt; &gt; &gt; Ming Wen, Apache APISIX
&gt; &gt; &gt; Twitter: _WenMing
&gt; &gt; &gt;
&gt; &gt; &gt;
&gt; &gt; &gt; YuanSheng Wang <[email protected]&gt; ??2019??11??6?????? 
????10:14??????
&gt; &gt; &gt;
&gt; &gt; &gt; &gt; Hi:
&gt; &gt; &gt; &gt;
&gt; &gt; &gt; &gt; For the upstream node list, we should allow new nodes to be 
added to
&gt; it
&gt; &gt; &gt; via
&gt; &gt; &gt; &gt; Admin API.
&gt; &gt; &gt; &gt; Users only need to provide new node information.
&gt; &gt; &gt; &gt;
&gt; &gt; &gt; &gt; I think we can use PATCH + uri, with an extra parameter to 
indicate
&gt; the
&gt; &gt; &gt; &gt; data merge method: full replacement or partial modification.
&gt; &gt; &gt; &gt;
&gt; &gt; &gt; &gt; Here is an example:
&gt; &gt; &gt; &gt;
&gt; &gt; &gt; &gt; *Old data:*
&gt; &gt; &gt; &gt;
&gt; &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; {
&gt; &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "nodes": {
&gt; &gt; &gt; 
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
"127.0.0.1:8080": 1
&gt; &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; },
&gt; &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "type": 
"roundrobin",
&gt; &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "desc": 
"new upstream"
&gt; &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; }
&gt; &gt; &gt; &gt;
&gt; &gt; &gt; &gt; *Add new node:*
&gt; &gt; &gt; &gt;
&gt; &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; curl 
http://****/apisix/admin/upstreams/1/nodes?merge=partial -X
&gt; &gt; &gt; &gt; PATCH \
&gt; &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -d 
'{"127.0.0.1:8081":3}'
&gt; &gt; &gt; &gt;
&gt; &gt; &gt; &gt; *Current data:*
&gt; &gt; &gt; &gt;
&gt; &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; {
&gt; &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "nodes": {
&gt; &gt; &gt; 
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
"127.0.0.1:8080": 1,
&gt; &gt; &gt; 
&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
"127.0.0.1:8081": 3
&gt; &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; },
&gt; &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "type": 
"roundrobin",
&gt; &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "desc": 
"new upstream"
&gt; &gt; &gt; &gt;&nbsp;&nbsp;&nbsp;&nbsp; }
&gt; &gt; &gt; &gt;
&gt; &gt; &gt; &gt;
&gt; &gt; &gt; &gt; --
&gt; &gt; &gt; &gt; *MembPhis*
&gt; &gt; &gt; &gt; My github: https://github.com/membphis
&gt; &gt; &gt; &gt; Apache APISIX: https://github.com/apache/incubator-apisix
&gt; &gt; &gt; &gt;
&gt; &gt; &gt;
&gt; &gt;
&gt; &gt;
&gt; &gt; --
&gt; &gt;
&gt; &gt; *MembPhis*
&gt; &gt; My github: https://github.com/membphis
&gt; &gt; Apache APISIX: https://github.com/apache/incubator-apisix
&gt; &gt;
&gt;




=========================================================
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;????
 &nbsp;&nbsp;&nbsp;&nbsp; ??????????http://rmzdb.iteye.com
 &nbsp;&nbsp; 
 &nbsp;&nbsp; 
????????????????????????:??????????????????????????????????????,??????????????????????!
 =========================================================

Reply via email to