http删除请求到Google目录API返回412先决条件:位置if-Match
我一直在使用Postman将HTTP请求发送到Google的目录API。 GET请求正常工作(这表明管理令牌也可以正常工作),以获取用户的信息。
但是,我需要做的是删除用户,当我尝试此操作时,我会得到以下内容:
{
"error": {
"code": 412,
"message": "Precondition is not met.",
"errors": [
{
"message": "Precondition is not met.",
"domain": "global",
"reason": "conditionNotMet",
"location": "If-Match",
"locationType": "header"
}
]
}
}
我以前是我缺少ETAG的前提,这是我从用户中添加的东西,但它不起作用。我还尝试将“*”添加到IF-Match标签中,但这也不起作用。也许有一个或补丁请求有一种方法?
API参考是这样的: htttps> httpps:// deveraserers。 google.com/admin-sdk/directory/reference/rest/v1/users/delete
API也不在Google的参考页面上使用。我还尝试了我是超级播的多个域中,因此错误与特定的超级用户或域无关。
我还确保在多个测试中确保我要删除的用户不是任何类型的管理员。
我在下面添加图像,以表明GET API正常工作。因此,我只需要知道如何格式化API请求才能删除用户。
/I.SSTATIC.NET/KW9Y1.PNG“ ALT =”在此处输入图像说明”>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,在直接与Google交谈并看到Jay Lee(GAM的作者)遇到了同样的问题之后,我们发现您无法删除用户,如果
于能够从现在开始删除用户,您必须删除所有这些内容(许可证,管理员特权,保留保留规则),否则您必须将该用户的信息传输到另一个用户(以及其他任何Google要求您事先删除)。
“不满足前提条件”是模糊的,Google应该改变这一点,但这意味着上面的三件事尚未被删除。
在下面,我添加了多个链接,以确认我上面提到的内容以及在删除用户之前需要使用的API。
https://github.com/gam-team/gam/releases?gam-releases
? /rest/v1/transfers#dataTransfer“ rel =” nofollow noreferrer“> https://devervepers.google.com/admin-sdk/data-tata-transfer/reference/reference/rest/rest/v1/transfers/transfers#datatransfer
=“ https://developers.google.com/vault/guides/holds#python” rel =“ nofollow noreferrer”> https://develovelers.google.com/vault/guides/guides/guides/holds#pypython
href =“ https://develovelers.google.com/vault/reference/rest/v1/matters.acts.accounts/list” REST/V1/MATERS.HOSTS.ACCOUNT/LIST
Ok, after talking directly to Google and even seeing that Jay Lee (author of GAM) ran into the same problem, we found out that you can't delete a user if:
To be able to delete a user from now on, you must remove all these things (licenses, admin privileges, Vault retention rules) or you must transfer the information of that user to another user (along with whatever else Google asks you to remove beforehand).
The "Precondition is not met" is vague and Google should change this, but it means that one of the three things above have not been removed yet.
Below I am adding multiple links to confirm what I mentioned above as well as the APIs you need to use on users before being able to delete them.
https://groups.google.com/g/google-apps-manager/c/83kR-4MoPk0?pli=1
https://github.com/GAM-team/GAM/releases?gam-releases
https://developers.google.com/admin-sdk/data-transfer/reference/rest/v1/transfers#DataTransfer
https://developers.google.com/vault/guides/holds#python
https://developers.google.com/vault/reference/rest/v1/matters.holds.accounts/list