http删除请求到Google目录API返回412先决条件:位置if-Match

发布于 2025-01-24 12:42:47 字数 1359 浏览 2 评论 0 原文

我一直在使用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 =”在此处输入图像说明”>

I have been using Postman to send http requests to Google's Directory API. The GET request works fine (which shows that the admin token as well works fine) to get info for a user.

But, what I need to do is delete the user, and when I try this, I get the following back:

{
    "error": {
        "code": 412,
        "message": "Precondition is not met.",
        "errors": [
            {
                "message": "Precondition is not met.",
                "domain": "global",
                "reason": "conditionNotMet",
                "location": "If-Match",
                "locationType": "header"
            }
        ]
    }
}

I was presupposing that I was missing the etag, which is what I added from the user, but it did not work. I also tried adding "*" to the If-Match tag, and that did not work either. Maybe there is a way with a put or patch request?

The API reference is this: https://developers.google.com/admin-sdk/directory/reference/rest/v1/users/delete

The API does not work on Google's reference page either. I have also tried this in multiple domains where I am the super-admin so the error is not related to a specific super-user or domain.

I have also made sure, in multiple tests, that the user I am trying to delete is not an admin of any type.

I am adding images below to show that the GET api works fine. So I just need to know how to format the API request to be able to delete the user.

enter image description here

enter image description here

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

楠木可依 2025-01-31 12:42:47

好的,在直接与Google交谈并看到Jay Lee(GAM的作者)遇到了同样的问题之后,我们发现您无法删除用户,如果

  1. 它具有某种许可
  2. 是管理员的
  3. ,则它 Google Vault保留规则适用

于能够从现在开始删除用户,您必须删除所有这些内容(许可证,管理员特权,保留保留规则),否则您必须将该用户的信息传输到另一个用户(以及其他任何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:

  1. It has a license of some sort
  2. It's an admin
  3. It has a Google Vault retention rule applied

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文