【发布时间】:2017-07-18 01:35:48
【问题描述】:
我正在尝试使用 curl 调用 IAM api,特别是 organizations.roles.list 方法。
https://cloud.google.com/iam/reference/rest/v1/organizations.roles/list
根据文档,我的请求应该是这样构造的:
https://iam.googleapis.com/v1/organizations/<org-id>/roles
但是,调用它会导致此错误:
{ “错误”:{ “代码”:404, "message": "找不到服务 iam.googleapis.com 的方法 ListRoles", “状态”:“NOT_FOUND”} }
完整请求:curl -H "Authorization: Bearer $(gcloud auth print-access-token)" https://iam.googleapis.com/v1/organizations/<org-id>/roles
我做错了什么?
【问题讨论】:
-
我猜这个问题已经过时了(将近 1 年),但我已经复制粘贴了您的 curl 请求,并且它正确返回了我的组织中的自定义角色。如果这对您来说仍然失败,那么在您尝试
curl -H"Authorization: Bearer $(gcloud auth print-access-token)" -H'content-type: application/json' https://cloudresourcemana ger.googleapis.com/v1/organizations:search -d'{}'时是否会显示组织 ID? -
我刚刚检查了 the release notes for the IAM API,似乎自定义角色直到 17 年 9 月才进入测试阶段。由于您的问题来自 17 年 7 月,我假设它现在可以正常工作,并且该错误与当时未发布有关。
标签: google-cloud-platform google-cloud-iam