Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

request help:How to send PATCH requests? #1505

Closed
Weimc-w opened this issue Apr 26, 2020 · 4 comments · Fixed by #1609
Closed

request help:How to send PATCH requests? #1505

Weimc-w opened this issue Apr 26, 2020 · 4 comments · Fixed by #1609

Comments

@Weimc-w
Copy link

Weimc-w commented Apr 26, 2020

当发送patch请求时传递的参数是一个json对象,只会把apisix中存在参数对应的值改变,未传参的配置会被清空。需求是改变传递参数的值,未传参的配置不变。
patchRequest

@ShiningRush
Copy link
Contributor

According admin api doc, You should specify property in your path.
You can have a try for

curl --location --request PATCH 'http://127.0.01:9080/apisix/admin/services/5/desc' \
--data-raw '"pathTest"'

curl --location --request PATCH 'http://127.0.01:9080/apisix/admin/services/5/upstream_id' \
--data-raw '"1"'

@Weimc-w
Copy link
Author

Weimc-w commented Apr 27, 2020

According admin api doc, You should specify property in your path.
You can have a try for

curl --location --request PATCH 'http://127.0.01:9080/apisix/admin/services/5/desc' \
--data-raw '"pathTest"'

curl --location --request PATCH 'http://127.0.01:9080/apisix/admin/services/5/upstream_id' \
--data-raw '"1"'

指定具体属性是可以使用的,但是这样会有个缺陷就是通过java项目配置的时候就需要传递一堆不同的参数来达到修改部分配置的需求。期望是通过java调用的时候能够传递进去一个实体类对象,然后将实体类中有赋值的配置改变,没赋值的配置保持不变

@moonming
Copy link
Member

According admin api doc, You should specify property in your path.
You can have a try for

curl --location --request PATCH 'http://127.0.01:9080/apisix/admin/services/5/desc' \
--data-raw '"pathTest"'

curl --location --request PATCH 'http://127.0.01:9080/apisix/admin/services/5/upstream_id' \
--data-raw '"1"'

指定具体属性是可以使用的,但是这样会有个缺陷就是通过java项目配置的时候就需要传递一堆不同的参数来达到修改部分配置的需求。期望是通过java调用的时候能够传递进去一个实体类对象,然后将实体类中有赋值的配置改变,没赋值的配置保持不变

not support this feature yet, and welcome PR.

@membphis membphis removed their assignment May 14, 2020
@membphis
Copy link
Member

I think we can implement it with this way, here is the mail list: https://lists.apache.org/thread.html/99ad8c5fa9f9ff9779cdb226b1ec41fc29c1bef62876f3872680d70f%40%3Cdev.apisix.apache.org%3E

@nic-chen do you have time to take a look at this PR?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants