【问题标题】:G Suite Users: list api call fails with response 400:Bad RequestG Suite 用户:list api 调用失败,响应为 400:Bad Request
【发布时间】:2020-06-28 21:42:13
【问题描述】:

下面是请求

GET /admin/directory/v1/users? HTTP/1.1
Host: www.googleapis.com
Authorization: Bearer xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Content-Type: application/json

下面是回复

{
    "error": {
        "errors": [
            {
                "domain": "global",
                "reason": "badRequest",
                "message": "Bad Request"
            }
        ],
        "code": 400,
        "message": "Bad Request"
    }
}

根据他们的documentation,此请求是正确的。如果您尝试“试试看!” documentation page 左上角的功能,您仍然会遇到此问题。我的请求有什么问题,请帮忙。

【问题讨论】:

    标签: google-api google-apps google-workspace gsuite-addons


    【解决方案1】:

    经过一番努力,我找到了答案。问题出在 customer 参数上,即使它在您必须提供的文档中被指定为可选。以下是我账户下的用户检索成功的请求。

    GET /admin/directory/v1/users?customer=my_customer HTTP/1.1
    Host: www.googleapis.com
    Authorization: Bearer ya29.a0Adw1xeWNBqbsl1krQ0vdnIlKzWLROC0xe-jW7TvHvljX3M3DAw_fXR5xgy2Msfif2WtdBILEjRDwSIUfC9v-2F1ssV9TQJ-lu-O1yywHUuDn5Eb8oiyyaNkBRUyIVDAuZkH2Q4EbYUCYFJzcVzyFYBIqmeCc0KzNv3Kb-qE2awHulI_Mm1LhyDJqtIPnFnMxngx7QoD0qJsDHgysphGYdg
    Content-Type: application/json
    

    【讨论】:

      猜你喜欢
      • 2020-04-23
      • 1970-01-01
      • 2020-10-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-29
      • 1970-01-01
      相关资源
      最近更新 更多