
# 获取入会Token（API名称：SaasLive/getToken）
#### 功能介绍
用于与客户系统对接获取视频入会Token。
#### 相关接口
| **接口名称**                                                             | **调用说明**                                                     |
|:---|:---|
| [获取Token](https://support.huaweicloud.com/api-isdp/api_01_0019.html) | 调用该接口获取到Token，再调用其他接口时，需要在请求消息头中添加"Authorization"，其值即为Token。 |
   
#### URL
| **请求方式** | **HTTPS地址**                                        | **服务架构** | **消息体类型**        |
|:---|:---|:---|:---|
| POST     | https://***isdp+域名***/openapi/v1/SaasLive/getToken | OpenAPI  | application/json |
   
#### 请求头
| **KEY**       | VALUE                  | 是否必填 | **描述**                                                                                           |
|:---|:---|:---|:---|
| Content-Type  | application/json       | 是    | 无                                                                                                |
| Authorization | bearer ${access_token} | 是    | bearer +" "+[5.2.1](https://support.huaweicloud.com/api-isdp/api_01_0019.html)中获取的access_token的值 |
   
#### 请求参数
| **参数**      | **类型** | **是否必填** | **描述**  |
|:---|:---|:---|:---|
| channelId   | String | 是        | 频道ID    |
| userAccount | String | 是        | 用户账号    |
| role        | int    | 是        | 角色，默认传1 |
   
#### 响应参数
| **字段名**              | **数据类型** | **字段名称** |
|:---|:---|:---|
| proxy                | String   | 代理       |
| appId                | String   | app唯一标识  |
| expirationTime       | int      | 超时时间     |
| tokenBegin           | String   | 令牌有效开始时间 |
| tokenEnd             | String   | 令牌有效结束时间 |
| token                | String   | 令牌       |
| publishUrl           | String   | 推流地址     |
| transcodingFramerate | String   | 转码帧率     |
| transcodingWidth     | String   | 转码宽度     |
| currentPushSum       | String   | 当前推流路数   |
| pushEnable           | String   | 推流是否可用   |
| pushLimit            | String   | 推流限制     |
| transcodingHeight    | String   | 转码高度     |
| transcodingBitrate   | String   | 码率       |
| networkQuality       | String   | 网络质量     |
| playQuality          | String   | 播放质量     |
| playQualityCondition | String   | 播放质量各参数值 |
| proxyList            | String   | 代理列表     |
| metering             | String   | 计费信息     |
| safetyHelmetInfo     | String   | 安全帽信息    |
   
#### 请求示例
```
{
    " channelId ": "10882",
    " userAccount ": "135965565",
    " role ": "1"
}
```
#### 响应示例
```
{
    "status": 1,
    "message": "SUCCESS",
    "error": null,
    "data": {
        "proxy": "video.isdp.test.xxxx.com",
        "appId": "b78e8a89d5034d27b522c3f1f12ed1c5",
        "expirationTime": 120,
        "tokenBegin": "2021-03-03T11:27:45",
        "tokenEnd": "2021-03-03T11:29:45",
        "token": "006b78e8a89d503**************************zYAPhLSLyjsrLQ/mZEkAtnHeF8AAAAAIgA77pRcsFNAYAQAAQC*************j9g",
        "publishUrl": "rtmp://pushdev.xxxx.com/live/2253_10882",
        "publishInfo": {
            "transcodingFramerate": 0,
            "transcodingWidth": 0,
            "currentPushSum": 2,
            "pushEnable": true,
            "pushLimit": 100,
            "transcodingHeight": 0,
            "transcodingBitrate": 0
        },
        "networkQuality": {
            "normal": "16-30",
            "strong": "0-15",
            "bad": "51-100",
            "weak": "31-50"
        },
        "playQuality": {
            "frameRate": 15,
            "bitRate": 320,
            "resolutionHeight": 360,
            "resolutionWidth": 480
        },
        "playQualityCondition": {
            "t4G": 31,
            "t5G": 31,
            "t2G": 0,
            "CPU": 80,
            "t3G": 0,
            "WIFI": 31
        },
        "proxyList": [
            "172-19-99-245.video.isdp.test.xxxx.com",
            "172-19-99-228.video.isdp.test.xxxx.com"
        ],
        "metering": {
            "message": "5003",
            "status": 0
        },
        "safetyHelmetInfo": {
            "resolutionRatio": null
        }
    },
    "timestamp": "2021-03-03T11:27:46.921+0800"
}
```
