文档首页> 云审计服务 CTS> API参考> 附录> 获取账号ID和项目ID
更新时间:2023-11-22 GMT+08:00

获取账号ID和项目ID

从控制台获取账号ID和项目ID

在调用接口的时候,部分URL中需要填入账号ID(domain-id)和项目ID,您可以通过控制台获取这些参数,步骤如下:

  1. 注册并登录管理控制台。单击用户名,在下拉列表中单击“我的凭证”。

  2. 在“我的凭证”页面查看账号ID和项目ID。

多项目时,展开“所属区域”,从“项目ID”列获取子项目ID。

调用API获取项目ID

获取项目ID的接口为“GET https://{Endpoint}/v3/projects”,其中{Endpoint}为IAM的终端节点。

响应示例如下,其中projects下的“id”即为项目ID。

{
    "projects": [
        {
            "domain_id": "65382450e8f64ac0870cd180xxxx",
            "is_domain": false,
            "parent_id": "65382450e8f64ac0870cd180d1xxxx",
            "name": "xx-region-1",
            "description": "",
            "links": {
                "next": null,
                "previous": null,
                "self": "https://www.example.com/v3/projects/a4a5d4098fb4474fa22cd05f89xxxx"
            },
            "id": "a4a5d4098fb4474fa22cd0xxxx",
            "enabled": true
        }
    ],
    "links": {
        "next": null,
        "previous": null,
        "self": "https://www.example.com/v3/projects"
    }
}