调用GetAuthorization,获取用户授权信息。

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

请求语法

GET /api/v1/authorization HTTP/1.1
Content-Type:application/json

公共请求参数

请求参数

调用OpenAPI必须传入用户的AccessId,AccessKey。无需手动传入用户ID,可以在服务端自动获得调用API用户ID。

响应体语法

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "String",
  "Authorized" : Boolean,
  "AuthorizationFailedCode" : "String",
  "AuthorizationFailedMessage" : "String"
}

响应参数

表 1. 响应Body参数
参数名称 类型 示例 说明
RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3****

请求ID

Authorized Boolean true

是否已经给DSW服务账号授权

  • true 已授权
  • false 未授权
AuthorizationFailedCode String EntityNotExist.Role

授权失败错误代码

AuthorizationFailedMessage String https://ram.console.aliyun.com/role/authorize?request=%7B%22ReturnUrl%22%3A%22http%3A%2F%2Fpai.data.aliyun.com%2Fbuy%3Fregion%3Dcn-beijing%23%2Fbuy%22%2C%22Services%22%3A%5B%7B%22Service%22%3A%22PAI%22%2C%22Roles%22%3A%5B%7B%22RoleName%22%3A%22AliyunPAIDSWDefaultRole%22%2C%22TemplateId%22%3A%22AliyunPAIDSWDefaultRole%22%7D%5D%7D%5D%7D

授权失败错误消息

获取用户的授权信息

GET /api/v1/authorization HTTP/1.1
Host:pai-dsw.aliyuncs.com
Content-Type:application/json

公共请求参数

正常返回示例

XML格式

HTTP/1.1 200 OK
Content-Type:application/xml

<GetAuthorizationResponse>
    <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3****</RequestId>
    <Authorized>true</Authorized>
    <AuthorizationFailedCode>EntityNotExist.Role</AuthorizationFailedCode>
    <AuthorizationFailedMessage>https://ram.console.aliyun.com/role/authorize?request=%7B%22ReturnUrl%22%3A%22http%3A%2F%2Fpai.data.aliyun.com%2Fbuy%3Fregion%3Dcn-beijing%23%2Fbuy%22%2C%22Services%22%3A%5B%7B%22Service%22%3A%22PAI%22%2C%22Roles%22%3A%5B%7B%22RoleName%22%3A%22AliyunPAIDSWDefaultRole%22%2C%22TemplateId%22%3A%22AliyunPAIDSWDefaultRole%22%7D%5D%7D%5D%7D</AuthorizationFailedMessage>
</GetAuthorizationResponse>

JSON格式

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****",
  "Authorized" : true,
  "AuthorizationFailedCode" : "EntityNotExist.Role",
  "AuthorizationFailedMessage" : "https://ram.console.aliyun.com/role/authorize?request=%7B%22ReturnUrl%22%3A%22http%3A%2F%2Fpai.data.aliyun.com%2Fbuy%3Fregion%3Dcn-beijing%23%2Fbuy%22%2C%22Services%22%3A%5B%7B%22Service%22%3A%22PAI%22%2C%22Roles%22%3A%5B%7B%22RoleName%22%3A%22AliyunPAIDSWDefaultRole%22%2C%22TemplateId%22%3A%22AliyunPAIDSWDefaultRole%22%7D%5D%7D%5D%7D"
}

错误码

访问错误中心查看更多错误码。

开发者资源

  • SDK

    阿里云为您提供多种语言的SDK,帮助您快速通过API集成阿里云的产品和服务,推荐您使用SDK调用API,已免除您手动签名验证。

  • OpenAPI Explorer

    快速检索,可视化调试API,在线命令行工具,同步动态生成可执行的SDK代码示例。

  • 阿里云CLI

    阿里云资产管理和配置工具,可通过命令方式同时管理多个阿里云产品和服务,简单快捷,是您上云好帮手。