PUT means to update all fields, so you have to provide all fields, but PATCH means just update the field provided.
Best Regards! @ Zhiyuan Ju <https://www.shaoyaoju.org/> hui li <[email protected]> 于2019年11月6日周三 上午10:35写道: > why not use PUT+uri? > > 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 > > >
