Google api 谷歌API调用:“;此URL不支持HTTP方法PUT。”;URL可能有什么问题?

Google api 谷歌API调用:“;此URL不支持HTTP方法PUT。”;URL可能有什么问题?,google-api,google-admin-sdk,google-directory-api,Google Api,Google Admin Sdk,Google Directory Api,答复: <HEAD> <TITLE>HTTP method PUT is not supported by this URL</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF" TEXT="#000000"> <H1>HTTP method PUT is not supported by this URL</H1> <H2>Error

答复:

<HEAD>
<TITLE>HTTP method PUT is not supported by this URL</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>HTTP method PUT is not supported by this URL</H1>
<H2>Error 405</H2>
</BODY>
</HTML>
, finalURL=https://www.googleapis.com/auth/admin/directory/v1/users/ttestaccount@pps.net, headers={Alt-Svc=h3-Q050=":443"; ma=2592000,h3-29=":443"; ma=2592000,h3-27=":443"; ma=2592000,h3-T051=":443"; ma=2592000,h3-T050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43", Cache-Control=private, max-age=0, Content-Security-Policy=frame-ancestors 'self', Content-Type=text/html; charset=UTF-8, Date=Tue, 22 Sep 2020 23:03:06 GMT, Expires=Tue, 22 Sep 2020 23:03:06 GMT, Server=GSE, Transfer-Encoding=chunked, X-Content-Type-Options=nosniff, X-Frame-Options=SAMEORIGIN, X-XSS-Protection=1; mode=block}, initialURL=https://www.googleapis.com/auth/admin/directory/v1/users/ttestaccount@pps.net, statusCode=405.0, statusReason=HTTP method PUT is not supported by this URL}
<br><br>


此URL不支持HTTP方法PUT
此URL不支持HTTP方法PUT
错误405
,终局=https://www.googleapis.com/auth/admin/directory/v1/users/ttestaccount@pps.net,headers={Alt Svc=h3-Q050=“:443”;ma=2592000,h3-29=“:443”;ma=2592000,h3-27=“:443”;ma=2592000,h3-T051=“:443;ma=2592000,h3-Q046=“:443”;ma=2592000,h3-Q043=“:443”;ma=2592000,quic=“:443”;ma=2592000;v=“46,43”,Cache Control=private,max age=0,Content Security Policy=frame祖先“self”,Content Type=text/html;charset=UTF-8,Date=Tue,22 Sep 2020 23:03:06 GMT,Expires=Tue,22 Sep 2020 23:03:06 GMT,Server=GSE,Transfer Encoding=chunked,X-Content-Type-Options=nosniff,X-frame-Options=SAMEORIGIN,X-XSS-Protection=1;mode=block},初始URL=https://www.googleapis.com/auth/admin/directory/v1/users/ttestaccount@pps.net,statusCode=405.0,statusReason=HTTP方法PUT不受此URL支持}


似乎我使用的URL格式与谷歌参考指南中推荐的相同:


如果我尝试使用方法补丁而不是PUT,我会得到:“RFC 2068中未定义方法补丁,Servlet API不支持该方法补丁”我可以看到您正在使用此URL:
https://www.googleapis.com/auth/admin/directory/v1/users/ttestaccount@pps.net
而不是使用
https://www.googleapis.com/admin/directory/v1/users/userKey
没有…/auth/。。。例如,其中userKey应该是格式为D04x2xmn8的唯一标识符。如果我取出/auth/I获取HTTP响应statusCode=403.0,statusReason=Forbidden。Google参考网站说用户密钥“可以是用户的主电子邮件地址、别名电子邮件地址或唯一用户ID。”在这种情况下,我使用的是主电子邮件地址。HTTP 405表示该URL中不允许使用方法。如果通过删除/auth获得403,可能是因为您没有使用授权范围或您的令牌已过期。作为我提出请求的建议。请记住Auth范围,在本例中:
https://www.googleapis.com/auth/admin.directory.user