目录

账号绑定接口

1. 服务器Url

https://hag.cloud.huawei.com/open-ability/v1

2. 账号绑定通知

基本信息

方法:POST

URL:/open-account-events/bind

说明:开发者服务器通知小艺开放平台服务器,绑定开发者使用的OpenID和华为账号UserId

请求头域

头域名称

描述

是否必选

类型

取值范围

x-appid

开发者在华为开发者联盟注册的小程序的编号

是

string

正则Pattern:[0-9]{1,20}

Authorization

应用级AccessToken,前面需要加上Bearer。

是

string

正则Pattern:[0-9]{1,20}

Content-Type

固定值,填application/json。

是

string

正则Pattern:[0-9]{1,20}

Accept

固定值,填application/json。

是

string

正则Pattern:[0-9]{1,20}

请求消息

响应消息

响应码:200

响应码:400

响应码:401

响应码:403

响应码:429

响应码:500

响应码:其它错误码

3. 账号解绑通知

基本信息

方法:POST

URL:/open-account-events/unbind

说明:开发者服务器通知小艺开放平台服务器,解绑开发者使用的OpenID和华为账号UserId

请求头域

头域名称

描述

是否必选

类型

取值范围

x-appid

开发者在华为开发者联盟注册的小程序的编号。

是

string

正则Pattern:[0-9]{1,20}

Authorization

应用级AccessToken,前面需要加上Bearer。

是

string

正则Pattern:[0-9]{1,20}

Content-Type

固定值,填application/json。

是

string

正则Pattern:[0-9]{1,20}

Accept

固定值,填application/json。

是

string

正则Pattern:[0-9]{1,20}

请求消息

响应消息

响应码:200

响应码:400

响应码:401

响应码:403

响应码:429

响应码:500

响应码:其它错误码

4. 基本类型结构

基本类型结构

[h2]4.1 ResultCode

结果类型,可以作为调用者在代码中识别结果细分类型的依据。

类型

取值范围

string

枚举值: invalidParam, tokenExpire, authFailed, userNotFound, usageLimits, backendError

[h2]4.2 ResultDesc

错误详情,帮助问题定位,人工阅读

invalidParam: 描述错误的参数,如:Parameter {} is invalid/should not be null/should be in [x,y] 等。

tokenExpire: 描述错误本身,如: User AccessToken Expired。

authFailed: 描述受限访问的资源,如: Forbid notify message of other app。

userNotFound: 描述错误本身,如: User not found。usageLimits: 描述受限的具体原因:如:Request per minutes exceeds max limit。

backendError: 不描述具体错误。直接返回 Backend server error。

类型

取值范围

string

/

5. 对象类型结构

对象类型结构

[h2]5.1 OpenAccountBindReq

成员名称

描述

是否必选

类型

取值范围

requestTime

请求报文的发送时间,格式:yyyymmddhhmmssSSS(UTC)

是

string

正则Pattern:[0-9]{17}

openId

开发者账号与华为账号的关联ID

是

string

最大长度:512

abilityId

通知的服务ID

否

string

最大长度:128

[h2]5.2 OpenAccountUnbindReq

成员名称

描述

是否必选

类型

取值范围

requestTime

账号解除绑定,用于辅助性能问题定位使用,格式:yyyymmddhhmmssSSS

是

string

正则Pattern:[0-9]{17}

openId

开发者账号与华为账号的关联ID

是

string

最大长度:512

[h2]5.3 ResultInfo

成员名称

描述

是否必选

类型

取值范围

code

结果类型,可以作为调用者在代码中识别结果细分类型的依据。

是

string(ResultCode)

/

desc

错误详情,帮助问题定位,人工阅读invalidParam: 描述错误的参数,如:Paramter {} is invalid/should not be null/should be in [x,y] 等。tokenExpire: 描述错误本身,如: User AccessToken Expired.authFailed: 描述受限访问的资源,如: Forbid notify message of other app.userNotFound: 描述错误本身,如: User not found.usageLimits: 描述受限的具体原因:如:Request per minutes exceeds max limit.backendError: 不描述具体错误。直接返回 Backend server error.

是

string(ResultDesc)

/