大家好,我正在尝试通过curl使用RestAPI从我的Bitbucket服务器(v7.1.1)上的组中删除一个用户。我在这里遵循文档(https://docs.atlassian.com/bitbucket-server/rest/7.6.0/bitbucket-rest.html#idp36)
下面是我正在使用的curl语法
curl -D- -u user:* -X GET -H "Content-Type: application/json" "https://*.*.com:8443/rest/api/1.0/admin/users/remove-group?&context=johnsmith&itemName=group1"下面是我的响应错误
HTTP/1.1 405
Cache-Control: private
Expires: Thu, 01 Jan 1970 00:00:00 GMT
X-AREQUESTID: @KLMZ8Ux485x1589179x0
X-ASEN: SEN-11523232
X-AUSERID: 1
X-AUSERNAME: user
Allow: POST,OPTIONS
X-Content-Type-Options: nosniff
vary: accept-encoding
Content-Type: application/json;charset=UTF-8
Transfer-Encoding: chunked
Date: Tue, 26 Oct 2021 13:05:13 GMT我可以做些什么来解决我的请求?也许我在语法中遗漏了一些东西,我在调试时遇到了问题,我很感谢这里的任何建议!谢谢。
发布于 2021-10-27 19:01:06
我找到了我的解决方案。我需要使用POST而不是GET,并将参数转换为json有效负载。下面的语法适用于我。
curl -D- -u "user:*" -X POST -H "Content-Type: application/json" -d "{\"context\": \"johnsmith\",\"itemName\": \"group1\"}" "https://*.com:8443/rest/api/1.0/admin/users/remove-group" https://stackoverflow.com/questions/69723729
复制相似问题