AI开发平台MODELARTS-获取项目ID和名称:调用API获取项目ID

时间:2024-11-22 17:41:06

调用API获取项目ID

项目ID通过调用查询指定条件下的项目信息API获取。

获取项目ID的接口为GET https://{iam-endpoint}/v3/projects,其中{iam-endpoint}为IAM的终端节点,可以从地区和终端节点处获取。

响应示例如下,例如ModelArts部署的区域为"cn-north-4",响应消息体中查找“name”为"cn-north-4",其中projects下的“id”即为项目ID。

{
	"projects": [{
		"domain_id": "65382450e8f64ac0870cd180d14e684b",
		"is_domain": false,
		"parent_id": "65382450e8f64ac0870cd180d14e684b",
		"name": "cn-north-4",
		"description": "",
		"links": {
			"next": null,
			"previous": null,
			"self": "https://www.example.com/v3/projects/a4a5d4098fb4474fa22cd05f897d6b99"
		},
		"id": "a4a5d4098fb4474fa22cd05f897d6b99",
		"enabled": true
	}],
	"links": {
		"next": null,
		"previous": null,
		"self": "https://www.example.com/v3/projects"
	}
}
support.huaweicloud.com/api-modelarts/modelarts_03_0147.html