虎牙开放平台文档

开放API 协议说明

1.根据房间号获取签约公会信息

GET https://open-apiext.huya.com/channel/index?do=getChannelInfoByRoom
1.1.接口参数
参数名称类型描述
appIdstring开发者的appId
roomIdint房间号
iatintjwt签发时间(unix时间戳),即生成sToken的当前unix时间戳
expintjwt过期时间(unix时间戳),通常exp=iat+600,注意不少于当前时间且不超过当前时间60分钟
sTokenstringjwt鉴权生成的token
1.2.返回(JSON)
返回字段
字段名称类型描述
codeint参考下面的接口返回码
messagestring消息提示
data["channelNumber"]long公会号
data["channelName"]string公会名称
data["channelLogo"]string公会LOGO
data["isPlaintum"]booltrue:是白金公会;false:非白金公会
data["channelDesc"]string公会描述
接口返回码
返回码描述
200成功
407鉴权失败
500查不到对应信息
其他失败
1.3.调用例子
curl "https://open-apiext.huya.com/channel/index?do=getChannelInfoByRoom&roomId=518512&appId=xxxxxxxxxxxx&iat=1556265172&exp=1556265772&sToken=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE1NTYyNjUxNzIsImV4cCI6MTU1NjI2NTc3MiwiYXBwSWQiOiJ4eHh4eHh4eHh4eHgifQ.1dOIN4nYNxnWawvM5TtOR6tN0Wmb8CvNfwGngpxcRcI"
1.4.接口返回JSON
成功返回
{ "code": 200, "message": "", "data": { "channelDesc": "虎牙官方星秀公会", "isPlaintum": true, "channelName": "虎牙星秀", "channelNumber": 9068, "channelLogo": "https://huyaimg.msstatic.com/cdnimage/channellogo/5f18/72/9209e0c0f851a53a7b04d5b359_100_100_1534313187040.jpg" } }
失败返回
{ "code": 500, "message": "房间号不存在", "data": null }