JAVA调用直播接口详述

一、userId、appId、appSecret值的获取

developer
在直播管理后台,点击开发设置,在显示的页面中获取userId、appId、appSecret值。

二、sign生成规则

将请求所需所有参数按照参数名字典顺序排列,连接参数名与参数值,并在首尾加上appSecret,然后计算MD5,将MD5结果转为16进制、大写字母,作为sign。

三、Java 接口调用示例

1、接口请求示例

private static void testBasic() {
        String url = "http://api.polyv.net/live/v3/channel/basic/get";
        // 用户对应的appId和加密串
        String appId = "xxxxxxx";
        String appSecret = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
        // 查询频道号
        String channelId = "415174";

        Map<String, String> params = new HashMap<>();
        params.put("channelId", channelId);
        // 调用Polyv的工具类方法设置sign
        PolyvTool.setLiveSign(params, appId, appSecret);
        // 调用Polyv的httpClient工具类发送请求
        String content = HttpClientUtil.getInstance()
                .sendHttpGet(url + "?" + PolyvTool.mapJoinNotEncode(params));
        System.out.println(content);
    }

2、生成sign结果示例

// 请求参数(这里为频道号)
channelId = "415174";
// appId和appSecret
appId = "egyszbtsd58";
appSecret = "6ef8d34c08f44e91a18e28d42ff0da7e";
// 时间戳
timeStamp = "1594369061376";
// 拼接后字符串
6ef8d34c08f44e91a18e28d42ff0da7eappIdegyszbtsd58channelId415174timestamp15943690613766ef8d34c08f44e91a18e28d42ff0da7e
// 加密串
7DEDD50579ECB5E5062954DBA10ADCA1

四、Java sign签名生成工具类

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;

/**
 * polyv工具类
 */
public class PolyvTool {

    /**
     * 获取加密串
     */
    public static void setLiveSign(Map<String, String> params, String appId, String key) {
        params.put("sign", getSign(params, appId, key));
    }

    /**
     * 获取加密串
     */
    public static String getSign(Map<String, String> params, String appId, String key) {
        params.put("appId", appId);
        params.put("timestamp", String.valueOf(System.currentTimeMillis()));
        // 处理参数,计算MD5哈希值
        String concatStr = concatParams(params);
        String plain = key + concatStr + key;
        System.out.println("request signStr=" + plain);
        String encrypted = md5Hex(plain);
        // 32位大写MD5值
        return encrypted.toUpperCase();
    }

    /**
     * 把数组所有元素排序,并按照“参数参数值”的模式成字符串,用于计算MD5哈希值
     * @param params 需要排序并参与字符拼接的参数组
     * @return 拼接后字符串
     */
    public static String concatParams(Map<String, String> params) {
        List<String> keys = new ArrayList<>(params.keySet());
        Collections.sort(keys);

        StringBuilder sb = new StringBuilder();
        for (String key : keys) {
            String value = params.get(key);
            if (isBlank(value)) {
                continue;
            }
            sb.append(key).append(value);
        }
        return sb.toString();
    }

    /**
     * 对字符串做MD5加密,返回加密后的字符串。
     * @param text 待加密的字符串。
     * @return 加密后的字符串。
     */
    public static String md5Hex(String text) {
        try {
            MessageDigest messageDigest = MessageDigest.getInstance("MD5");
            byte[] inputByteArray = text.getBytes();
            messageDigest.update(inputByteArray);
            byte[] resultByteArray = messageDigest.digest();
            return byteArrayToHex(resultByteArray).toLowerCase();
        } catch (NoSuchAlgorithmException e) {
            return null;
        }
    }

    /**
     * 将字节数组换成成16进制的字符串
     * @param byteArray 字节
     * @return 字符串
     */
    public static String byteArrayToHex(byte[] byteArray) {
        // 初始化一个字符数组用来存放每个16进制字符
        char[] hexDigits = {'0','1','2','3','4','5','6','7','8','9', 'A','B','C','D','E','F' };
        // new一个字符数组,这个就是用来组成结果字符串的(一个byte是八位二进制,也就是2位十六进制字符(2的8次方等于16的2次方))
        char[] resultCharArray =new char[byteArray.length * 2];
        // 遍历字节数组,通过位运算(位运算效率高),转换成字符放到字符数组中去
        int index = 0;
        for (byte b : byteArray) {
            resultCharArray[index++] = hexDigits[b>>> 4 & 0xf];
            resultCharArray[index++] = hexDigits[b& 0xf];
        }
        // 字符数组组合成字符串返回
        return new String(resultCharArray);
    }


    /**
     * url 参数串连但是不进行参数Encode
     * @param map map
     * @return string
     */
    public static String mapJoinNotEncode(Map<String, String> map) {
        StringBuilder stringBuilder = new StringBuilder();
        int i = 0;
        for (Map.Entry<String, String> entry : map.entrySet()) {
            String key = entry.getKey();
            String value = entry.getValue();
            if (isBlank(value)) {
                continue;
            }
            if (0 != i) {
                stringBuilder.append("&");
            }
            stringBuilder.append(key).append("=").append(map.get(key));
            i++;
        }
        return stringBuilder.toString();
    }

    /**
     * url 参数串连
     * @param map map
     * @param keyLower keyLower
     * @param valueUrlEncode valueUrlEncode
     * @return string
     */
    public static String mapJoin(Map<String, String> map, boolean keyLower, boolean valueUrlEncode) {
        StringBuilder stringBuilder = new StringBuilder();
        for (Map.Entry<String, String> entry : map.entrySet()) {
            String key = entry.getKey();
            String value = entry.getValue();
            if (isBlank(value)){
                continue;
            }

            try {
                String temp = (key.endsWith("_") && key.length() > 1) ? key.substring(0, key.length() - 1) : key;
                stringBuilder.append(keyLower ? temp.toLowerCase() : temp)
                        .append("=")
                        .append(valueUrlEncode ? URLEncoder.encode(value, "utf-8").replace("+", "%20") : value)
                        .append("&");
            } catch (UnsupportedEncodingException e) {
                System.out.println(e.getMessage());
            }
        }
        if (stringBuilder.length() > 0) {
            stringBuilder.deleteCharAt(stringBuilder.length() - 1);
        }
        return stringBuilder.toString();
    }

    /**
     * 判断字符是否为空
     * @param cs 字符
     * @return true/false
     */
    public static boolean isBlank(CharSequence cs) {
        int strLen;
        if (cs != null && (strLen = cs.length()) != 0) {
            for(int i = 0; i < strLen; ++i) {
                if (!Character.isWhitespace(cs.charAt(i))) {
                    return false;
                }
            }

            return true;
        } else {
            return true;
        }
    }
}

五、Java http请求调用工具类

注:该工具类仅为示例(非必须),客户可以按照自己的方式进行接口请求,如需在生产环境使用该工具类,客户需按需进行httpClient的一些配置优化

1、使用该工具类需要引入apache的工具包,下面提供该工具包的maven引用方式

<dependency>
   <groupId>org.apache.httpcomponents</groupId>
   <artifactId>httpclient</artifactId>
   <version>4.5</version>
</dependency>
<dependency>
  <groupId>org.apache.httpcomponents</groupId>
  <artifactId>httpmime</artifactId>
  <version>4.5</version>
</dependency>

2、http请求工具类代码

import java.io.File;
import java.security.KeyManagementException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import javax.net.ssl.SSLContext;

import org.apache.http.Header;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.client.utils.HttpClientUtils;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.entity.mime.HttpMultipartMode;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.entity.mime.content.StringBody;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.ssl.SSLContextBuilder;
import org.apache.http.util.EntityUtils;

/**
 * httpclient的操作实现类
 */
public class HttpClientUtil {

    private static final String QUESTION_MARK = "?";
    private static final String DEFAULT_ENCODING = "UTF-8";
    private static final String APPLICATION_JSON_UTF8_VALUE = "application/json;charset=UTF-8";
    public static final String APPLICATION_FORM_URLENCODED_VALUE = "application/x-www-form-urlencoded";

    private final RequestConfig requestConfig = RequestConfig.custom().setSocketTimeout(10000).setConnectTimeout(10000)
            .setConnectionRequestTimeout(10000).build();

    private static HttpClientUtil instance = null;

    private HttpClient ignoreSslClient;

    private HttpClient client;

    private HttpClientUtil() {
        this.ignoreSslClient = createHttpsClient(true);
        this.client = createHttpsClient(false);
    }

    public static HttpClientUtil getInstance() {
        if (instance == null) {
            instance = new HttpClientUtil();
        }
        return instance;
    }

    private HttpClient getHttpClient(boolean ignoreSsl) {
        return ignoreSsl ? ignoreSslClient : client;
    }

    /**
     * 发送 post请求
     * @param httpUrl 地址
     * @return 请求结果
     */
    public String sendHttpPost(String httpUrl) {
        HttpPost httpPost = new HttpPost(httpUrl);
        return sendHttpPost(httpPost);
    }

    /**
     * 发送 post请求
     * @param httpUrl 地址
     * @param params 参数(格式:json格式的内容)
     * @param headers 请求头
     * @return 请求结果
     */
    public String sendHttpPostJson(String httpUrl, String params, Map<String, String> headers) {
        return sendHttpPostJson(httpUrl, params, headers, false);
    }

    /**
     * 发送 post请求
     * @param httpUrl 地址
     * @param params 参数(格式:json格式的内容)
     * @param headers 请求头
     * @param ignoreSsl 是否跳过证书校验,true为跳过 false为不跳过
     * @return 请求结果
     */
    public String sendHttpPostJson(String httpUrl, String params, Map<String, String> headers, boolean ignoreSsl) {
        // 创建httpPost
        HttpPost httpPost = new HttpPost(httpUrl);
        try {
            // 设置参数
            StringEntity stringEntity = new StringEntity(params, DEFAULT_ENCODING);
            stringEntity.setContentType(APPLICATION_JSON_UTF8_VALUE);
            httpPost.setEntity(stringEntity);
            if (null != headers && headers.size() > 0) {
                for (String name : headers.keySet()) {
                    httpPost.addHeader(name, headers.get(name));
                }
            }
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
        return sendHttpRequest(httpPost, ignoreSsl);
    }

    /**
     * 发送 post请求
     * @param httpUrl 地址
     * @param maps 参数
     * @param body 请求体
     * @return 请求结果
     */
    public String sendHttpPost(String httpUrl, Map<String, String> maps, String body) {
        String paramStr = PolyvTool.mapJoinNotEncode(maps);
        if (null != paramStr) {
            paramStr = QUESTION_MARK + paramStr;
        }
        String urlStr = httpUrl + paramStr;
        HttpPost httpPost = new HttpPost(urlStr);
        try {
            StringEntity entity = new StringEntity(body, DEFAULT_ENCODING);
            entity.setContentType(APPLICATION_JSON_UTF8_VALUE);
            httpPost.setEntity(entity);
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
        return sendHttpRequest(httpPost, true);
    }

    /**
     * 发送 post请求
     * @param httpUrl 地址
     * @param params 参数(格式:key1=value1&key2=value2)
     * @return 请求结果
     */
    public String sendHttpPost(String httpUrl, String params) {
        return sendHttpPostWithHeader(httpUrl, params, null);
    }

    /**
     * 发送 post请求
     * @param httpUrl 地址
     * @param headers 头
     * @param params 参数(格式:key1=value1&key2=value2)
     * @return 请求结果
     */
    public String sendHttpPostWithHeader(String httpUrl, String params, Header[] headers) {
        HttpPost httpPost = new HttpPost(httpUrl);
        try {
            if (null != headers) {
                httpPost.setHeaders(headers);
            }
            // 设置参数
            StringEntity stringEntity = new StringEntity(params, DEFAULT_ENCODING);
            stringEntity.setContentType(APPLICATION_FORM_URLENCODED_VALUE);
            httpPost.setEntity(stringEntity);
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
        return sendHttpPost(httpPost);
    }

    /**
     * 发送 post请求
     * @param httpUrl 地址
     * @param maps 参数
     * @return 请求结果
     */
    public String sendHttpPost(String httpUrl, Map<String, String> maps) {
        return sendHttpPostWithHeader(httpUrl, maps, null);
    }

    /**
     * 发送 post请求
     * @param httpUrl 地址
     * @param maps 参数
     * @return 请求结果
     */
    public String sendHttpPostWithHeader(String httpUrl, Map<String, String> maps, Header[] headers) {
        HttpPost httpPost = new HttpPost(httpUrl);
        if (null != headers) {
            httpPost.setHeaders(headers);
        }
        // 创建参数队列
        List<NameValuePair> nameValuePairs = new ArrayList<>();
        for (String key : maps.keySet()) {
            nameValuePairs.add(new BasicNameValuePair(key, maps.get(key)));
        }
        try {
            httpPost.setEntity(new UrlEncodedFormEntity(nameValuePairs, DEFAULT_ENCODING));
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
        return sendHttpPost(httpPost);
    }

    /**
     * 发送 get请求
     * @param httpUrl 地址
     * @param headers 请求头
     * @return 请求结果
     */
    public String sendHttpGet(String httpUrl, Map<String, String> headers) {
        // 创建httpGet
        HttpGet httpGet = new HttpGet(httpUrl);
        try {
            if (null != headers && headers.size() > 0) {
                for (String name : headers.keySet()) {
                    httpGet.addHeader(name, headers.get(name));
                }
            }
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
        return sendHttpGet(httpGet);
    }

    /**
     * 发送 post请求(带文件)
     * @param httpUrl 地址
     * @param maps 参数
     * @param fileLists 附件
     * @return 请求结果
     */
    public String sendHttpPost(String httpUrl, Map<String, String> maps, List<File> files, String fileParamName) {
        HttpPost httpPost = new HttpPost(httpUrl);
        MultipartEntityBuilder meBuilder = MultipartEntityBuilder.create();
        // 设置此参数后可以保证服务器拿到的文件名不会出现乱码
        meBuilder.setMode(HttpMultipartMode.RFC6532);
        for (String key : maps.keySet()) {
            meBuilder.addPart(key, new StringBody(maps.get(key), ContentType.TEXT_PLAIN));
        }
        for (File file : files) {
            FileBody fileBody = new FileBody(file);
            fileParamName = (null == fileParamName) ? "files" : fileParamName;
            meBuilder.addPart(fileParamName, fileBody);
        }
        HttpEntity reqEntity = meBuilder.build();
        httpPost.setEntity(reqEntity);
        return sendHttpPost(httpPost);
    }

    /**
     * 发送 post请求(带文件)
     * @param httpUrl 地址
     * @param maps 参数
     * @param file 上传文件
     * @param fileParamName 上传文件参数名
     */
    private static String sendHttpPost(String httpUrl, Map<String, String> maps, File file, String fileParamName) {
        fileParamName = (null == fileParamName) ? "file" : fileParamName;
        return sendHttpPost(httpUrl, maps, file, fileParamName);
    }

    /**
     * 发送Post请求
     * @param httpPost post请求
     * @return 请求结果
     */
    private String sendHttpPost(HttpPost httpPost) {
        return sendHttpRequest(httpPost);
    }

    /**
     * 发送 get请求
     * @param httpUrl 请求的路径
     * @return 成功时为响应内容,失败时为 null
     */
    public String sendHttpGet(String httpUrl) {
        // 创建get请求
        HttpGet httpGet = new HttpGet(httpUrl);
        return sendHttpGet(httpGet);
    }

    /**
     * 发送DELETE请求
     * @param httpUrl 请求的路径
     * @return 成功时为响应内容,失败时为 null
     */
    public String sendHttpDelete(String httpUrl) {
        HttpDelete httpDelete = new HttpDelete(httpUrl);
        return sendHttpRequest(httpDelete);
    }

    /**
     * 发送 get请求Https
     * @param httpUrl 请求的路径
     * @param ignoreSSLCerts 是否忽略证书校验
     */
    public String sendHttpsGet(String httpUrl, boolean ignoreSslCerts) {
        HttpGet httpGet = new HttpGet(httpUrl);
        return sendHttpsGet(httpGet, ignoreSslCerts);
    }

    /**
     * 发送Get请求
     * @param httpGet 请求
     * @return 成功时为响应内容,失败时为 null
     */
    private String sendHttpGet(HttpGet httpGet) {
        return sendHttpRequest(httpGet);
    }

    /**
     * 发送Get请求
     * @param requestBase 请求
     * @return 成功时为响应内容,失败时为 null
     */
    private String sendHttpRequest(HttpRequestBase requestBase) {
        return sendHttpRequest(requestBase, false);
    }

    /**
     * 发送请求
     * @param requestBase 请求
     * @param ignoreSslCerts 忽略证书和域名校验
     * @return 成功时为响应内容,失败时为 null
     */
    private String sendHttpRequest(HttpRequestBase requestBase, boolean ignoreSslCerts) {
        HttpResponse response = null;
        HttpEntity entity;
        try {
            // 创建默认的httpClient实例.
            requestBase.setConfig(requestConfig);
            // 执行请求
            response = getHttpClient(ignoreSslCerts).execute(requestBase);
            entity = response.getEntity();
            return EntityUtils.toString(entity, DEFAULT_ENCODING);
        } catch (Exception e) {
            System.out.println(e.getMessage());
        } finally {
            HttpClientUtils.closeQuietly(response);
        }
        return null;
    }

    /**
     * 发送Get请求Https
     * ignoreSSLCerts参数为true可以忽略证书和域名的校验,可以避免 {@link sun.security.validator.ValidatorException}
     * @param httpGet 使用https发送get请求
     * @param ignoreSSLCerts 忽略证书和域名校验
     * @return 返回内容
     */
    private String sendHttpsGet(HttpGet httpGet, boolean ignoreSslCerts) {
        HttpResponse response = null;
        String responseContent = null;
        try {
            httpGet.setConfig(requestConfig);
            // 执行请求
            response = getHttpClient(ignoreSslCerts).execute(httpGet);
            HttpEntity entity = response.getEntity();
            responseContent = EntityUtils.toString(entity, DEFAULT_ENCODING);
        } catch (Exception e) {
            System.out.println(e.getMessage());
        } finally {
            HttpClientUtils.closeQuietly(response);
        }
        return responseContent;
    }

    /**
     * 初始化https请求Client
     * @param ignoreSSLCerts 忽略证书
     */
    private CloseableHttpClient createHttpsClient(boolean ignoreSslCerts) {
        CloseableHttpClient httpClient;
        if (ignoreSslCerts) {
            SSLContext ctx = null;
            try {
                // 忽略客户端证书校验
                ctx = new SSLContextBuilder().loadTrustMaterial(null, (chain, authType) -> true).build();
            } catch (NoSuchAlgorithmException | KeyManagementException | KeyStoreException e) {
                System.out.println("create ssl context error");
            }

            // 忽略证书和hostName校验
            httpClient = HttpClients.custom()
                    .setSSLHostnameVerifier((host, session) -> true)
                    .setSSLSocketFactory(new SSLConnectionSocketFactory(ctx)).build();
        } else {
            httpClient = HttpClients.createDefault();
        }
        return httpClient;
    }

}
以上内容是否对您有帮助?根本没有帮助文档较差文档一般文档不错文档很好
Loading...

查询频道回调设置接口

接口URL

https://api.polyv.net/live/v3/channel/callback/get-setting

接口说明

1、接口用于查询频道回调设置接口
3、接口支持https

请求方式

GET

请求参数

参数名 必选 类型 说明
appId string 从API设置中获取,在直播系统登记的appId
timestamp long 当前13位当前时间戳,3分钟有效
sign string 签名值,32位大写MD5值
channelId int 频道ID

响应成功JSON示例:

// 查询成功
{
  "code": 200,
  "status": "success",
  "message": "",
  "data": {
    "recordCallbackUrl": "url",
    "playbackCallbackUrl": "url",
    "streamCallbackUrl": "url",
    "liveScanCallbackUrl": "url",
    "recordCallbackVideoType": "url",
    "playbackCacheCallbackUrl": "url",
    "pptRecordCallbackUrl": "url",
    "globalSettingEnabled": "N"
  }
}

字段说明

字段 说明
recordCallbackUrl 录制生成回调URL
playbackCallbackUrl 录制视频转存成功回调URL
streamCallbackUrl 流状态回调URL
liveScanCallbackUrl 直播内容审核回调URL
recordCallbackVideoType 录制回调的视频类型,多个视频类型用,分隔
playbackCacheCallbackUrl 回放缓存生成成功的回调URL
pptRecordCallbackUrl 课件重制成功回调URL
globalSettingEnabled 是否应用全局设置开关,Y走用户回调设置,N走频道设置

响应失败JSON示例:

// 签名错误
{
    "code": 403,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}
// 未输入appId
{
    "code": 400,
    "status": "error",
    "message": "appId is required.",
    "data": ""
}
// appId不正确
{
    "code": 400,
    "status": "error",
    "message": "application not found.",
    "data": ""
}
// 时间戳错误
{
    "code": 400,
    "status": "error",
    "message": "invalid timestamp.",
    "data": ""
}
// 频道非法
{
    "code": 400,
    "status": "error",
    "message": "illegal channel id: xxx",
    "data": ""
}

字段说明

参数名 说明
code 响应代码,成功为200,失败为400,签名错误为403,异常错误500
status 成功为success,失败为error
message 错误时为错误提示消息
data 成功修改信息

php请求示例

<?php
//引用config.php
include 'config.php';

$params = array(
  'appId' => "填写获取到的appId",
  'timestamp' => "填写13位时间戳",
  'channelId' => "填写频道号"
);

//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
$params["sign"] = $sign;

$url="https://api.polyv.net/live/v3/channel/callback/get-setting";

function post($url, $post_data = '', $timeout = 5){
   $ch = curl_init();
   curl_setopt ($ch, CURLOPT_URL, $url);
   curl_setopt ($ch, CURLOPT_POST, 1);
   if($post_data != ''){
      curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
   }

   curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
   curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
   curl_setopt($ch, CURLOPT_HEADER, false);
   $file_contents = curl_exec($ch);
   curl_close($ch);
   return $file_contents;
}

echo post($url, $params);
?>

签名规则(config.php文件代码查看)

http://dev.polyv.net/2018/liveproduct/l-api/rule/sign/

以上内容是否对您有帮助?根本没有帮助文档较差文档一般文档不错文档很好
Loading...

设置频道回调设置

接口URL

https://api.polyv.net/live/v3/channel/callback/update-setting

接口说明

1、接口用于修改频道回调设置接口
2、接口支持https
3、如频道需要跟随用户设置,可以调用设置频道默认项开关接口

请求方式

POST

请求参数

参数名 必选 类型 说明
appId string 从API设置中获取,在直播系统登记的appId
timestamp long 当前13位毫秒级时间戳,3分钟内有效
sign string 签名,32位大写MD5值
channelId int 频道ID
recordCallbackVideoType string 录制回调文件类型,可选值m3u8或mp4或m3u8,mp4
recordCallbackUrl string 录制回调http(s)地址,需要url编码,如果要清空设置传入空串
playbackCallbackUrl string 转存成功回调http(s)地址,需要url编码,如果要清空设置传入空串
streamCallbackUrl string 流状态回调http(s)地址,需要url编码,如果要清空设置传入空串
pptRecordCallbackUrl string 课件重制成功回调http(s)地址,需要url编码,如果要清空设置传入空串
liveScanCallbackUrl string 直播内容鉴别回调http(s)地址,需要url编码,如果要清空设置传入空串
playbackCacheCallbackUrl string 回放缓存回调http(s)地址,需要url编码,如果要清空设置传入空串

响应成功JSON示例:

// 修改成功
{
    "code": 200,
    "status": "success",
    "message": "",
    "data": null
}

响应失败JSON示例:

// 签名错误
{
    "code": 403,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}
// 未输入appId
{
    "code": 400,
    "status": "error",
    "message": "appId is required.",
    "data": ""
}
// appId不正确
{
    "code": 400,
    "status": "error",
    "message": "application not found.",
    "data": ""
}
// 时间戳错误
{
    "code": 400,
    "status": "error",
    "message": "invalid timestamp.",
    "data": ""
}
// 频道非法
{
    "code": 400,
    "status": "error",
    "message": "illegal channel id: xxx",
    "data": ""
}
// url非法
{
    "code": 400,
    "status": "error",
    "message": "url invalid:tttt",
    "data": ""
}
// recordCallbackVideoType非法
{
    "code": 400,
    "status": "error",
    "message": "invalid record callback type",
    "data": ""
}

字段说明

参数名 说明
code 响应代码,成功为200,失败为400,签名错误为403,异常错误500
status 成功为success,失败为error
message 错误时为错误提示消息
data 响应数据,这里暂无,为null

php请求示例

<?php
//引用config.php
include 'config.php';

$params = array(
  'appId' => $appId,
  'timestamp' => $timestamp,
  'channelId' =>  195770,
  'recordCallbackVideoType' => 'm3u8,mp4',
  'recordCallbackUrl' => ''
);

//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
$params['sign'] = $sign;

$url = "http://api.polyv.net/live/v3/channel/playback/set-setting?".http_build_query($params);

$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 500);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, 1);
$res = curl_exec($curl);
curl_close($curl);

echo $res;
?>

签名规则(config.php文件代码查看)

http://dev.polyv.net/2018/liveproduct/l-api/rule/sign/

以上内容是否对您有帮助?根本没有帮助文档较差文档一般文档不错文档很好
Loading...

修改回放视频名称

接口URL

https://api.polyv.net/live/v3/channel/playback/update-title

接口说明

1、接口用于修改回放列表中某个视频的名称(标题)
3、接口支持https

请求方式

POST

请求参数

参数名 必选 类型 说明
appId string 从API设置中获取,在直播系统登记的appId
timestamp long 当前13位当前时间戳,3分钟有效
sign string 签名值,32位大写MD5值
channelId int 频道ID
videoId string 回放视频ID
title string 回放视频名称

响应成功JSON示例:

// 修改成功
{
    "code": 200,
    "status": "success",
    "message": "",
    "data": ""
}

响应失败JSON示例:

// 签名错误
{
    "code": 403,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}
// 未输入appId
{
    "code": 400,
    "status": "error",
    "message": "appId is required.",
    "data": ""
}
// appId不正确
{
    "code": 400,
    "status": "error",
    "message": "application not found.",
    "data": ""
}
// 时间戳错误
{
    "code": 400,
    "status": "error",
    "message": "invalid timestamp.",
    "data": ""
}
// 频道非法
{
    "code": 400,
    "status": "error",
    "message": "illegal channel id: xxx",
    "data": ""
}
// 要修改的回放视频不存在
{
    "code": 400,
    "status": "error",
    "message": "playback video not exist",
    "data": ""
}
// 修改回放视频失败
{
    "code": 400,
    "status": "error",
    "message": "update playback video info error",
    "data": ""
}

字段说明

参数名 说明
code 响应代码,成功为200,失败为400,签名错误为403,异常错误500
status 成功为success,失败为error
message 错误时为错误提示消息
data 成功修改信息

php请求示例

<?php
//引用config.php
include 'config.php';

$params = array(
  'appId' => "填写获取到的appId",
  'timestamp' => "填写13位时间戳",
  'channelId' => "填写频道号",
  'videoId' => "填写回放视频ID",
  'title' => "填写回放视频名称(标题)"
);

//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
$params["sign"] = $sign;

$url="https://api.polyv.net/live/v3/channel/playback/update-title";

function post($url, $post_data = '', $timeout = 5){
   $ch = curl_init();
   curl_setopt ($ch, CURLOPT_URL, $url);
   curl_setopt ($ch, CURLOPT_POST, 1);
   if($post_data != ''){
      curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
   }

   curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
   curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
   curl_setopt($ch, CURLOPT_HEADER, false);
   $file_contents = curl_exec($ch);
   curl_close($ch);
   return $file_contents;
}

echo post($url, $params);
?>

签名规则(config.php文件代码查看)

http://dev.polyv.net/2018/liveproduct/l-api/rule/sign/

以上内容是否对您有帮助?根本没有帮助文档较差文档一般文档不错文档很好
Loading...

删除白名单

接口URL

https://api.polyv.net/live/v3/channel/auth/delete-white-list

接口说明

1、作用:用于删除指定观看白名单(支持一键清空)
2、接口支持https协议

返回结果支持格式

JSON

请求方式

POST

请求数限制

TRUE

请求参数

参数名 必选 类型 说明
appId string 从API设置中获取,在直播系统登记的appId
timestamp string 当前时间的秒级时间戳(13位)
sign string 签名,为32位大写的MD5值
channelId int 频道号(传频道号则删除频道观看白名单,不传频道号则删除全局观看白名单)
rank int 主要观看条件为1,次要观看条件为2
isClear String 是否一键清空白名单(Y :清空白名单;N:根据code请求白名单,code)
code string 会员码(isClear 为N时为必传参数)

操作成功响应示例

{
  "code": 200,
  "message": "",
  "status": "success",
  "data": "success"
}

操作失败响应示例

签名错误

{
    "code": 403,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}

缺少参数

{
    "code": 400,
    "status": "error"
    "message": "param should not be empty: name",
    "data": ""
}

参数不是Y/N类型错误

{
    "code": 400,
    "status": "error"
    "message": "param is not boolean (Y / N)",
    "data": ""
}

响应字段说明

名称 类型 说明
code string 响应代码,成功为200,失败为400,签名错误为401,异常错误500
status string 成功为success,失败为error
message string 错误时为错误提示消息
data string 成功返回信息

php请求示例

<?php
//引用config.php
include 'config.php';

$params = array(
  'appId' => $appId,
  'timestamp' => $timestamp,
  'channelId' => '123456',
  'isClear' => 'N',
  'code' => '会员码123',
  'rank' => '1';

//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法

$params["sign"] = $sign;
$url="https://api.polyv.net/live/v3/channel/auth/delete-white-list?".http_build_query($params);

function post($url, $post_data = '', $timeout = 5){
   $ch = curl_init();
   curl_setopt ($ch, CURLOPT_URL, $url);
   curl_setopt ($ch, CURLOPT_POST, 1);
   if($post_data != ''){
      curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
   }

   curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
   curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
   curl_setopt($ch, CURLOPT_HEADER, false);
   curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . strlen($post_data)));
   $file_contents = curl_exec($ch);
   curl_close($ch);
   return $file_contents;
}

echo post($url);
?>

签名规则(config.php文件代码查看)

http://dev.polyv.net/2018/liveproduct/l-api/rule/sign/

以上内容是否对您有帮助?根本没有帮助文档较差文档一般文档不错文档很好
Loading...

更新白名单

接口URL

https://api.polyv.net/live/v3/channel/auth/update-white-list

接口说明

1、作用:用于更新观看白名单信息
2、接口支持https协议

返回结果支持格式

JSON

请求方式

POST

请求数限制

TRUE

请求参数

参数名 必选 类型 说明
appId string 从API设置中获取,在直播系统登记的appId
timestamp string 当前时间的秒级时间戳(13位)
sign string 签名,为32位大写的MD5值
channelId int 频道号(传频道号则修改频道观看白名单,不传频道号则修改全局观看白名单)
rank int 主要观看条件为1,次要观看条件为2
oldCode string 旧会员码
code string 会员码(最多为50个字符)
name string 昵称(最多为50个字符)

操作成功响应示例

{
  "code": 200,
  "message": "",
  "status": "success",
  "data": "success"
}

操作失败响应示例

签名错误

{
    "code": 403,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}

缺少参数

{
    "code": 400,
    "status": "error"
    "message": "param should not be empty: name",
    "data": ""
}

参数长度过长

{
    "code": 400,
    "status": "error"
    "message": "param length is incorrect: name",
    "data": ""
}

参数类型错误

{
    "code": 400,
    "status": "error"
    "message": "param validate error",
    "data": ""
}

更新的白名单不存在

{
    "code": 400,
    "status": "error"
    "message": "whitelist is empty",
    "data": ""
}

要更新的白名单会员码已存在(当传入的两个会员码不同时)

{
    "code": 400,
    "status": "error"
    "message": "whitelist code exist",
    "data": ""
}

白名单昵称已存在

{
    "code": 400,
    "status": "error"
    "message": "whitelist name exist",
    "data": ""
}

响应字段说明

名称 类型 说明
code string 响应代码,成功为200,失败为400,签名错误为401,异常错误500
status string 成功为success,失败为error
message string 错误时为错误提示消息
data string 成功返回信息

php请求示例

<?php
//引用config.php
include 'config.php';

$params = array(
  'appId' => $appId,
  'timestamp' => $timestamp,
  'channelId' => '123456',
  'oldCode' => '会员码1',
  'name' => '昵称123',
  'code' => '会员码123',
  'rank' => '1';

//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法

$params["sign"] = $sign;
$url="https://api.polyv.net/live/v3/channel/auth/update-white-list?".http_build_query($params);

function post($url, $post_data = '', $timeout = 5){
   $ch = curl_init();
   curl_setopt ($ch, CURLOPT_URL, $url);
   curl_setopt ($ch, CURLOPT_POST, 1);
   if($post_data != ''){
      curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
   }

   curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
   curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
   curl_setopt($ch, CURLOPT_HEADER, false);
   curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . strlen($post_data)));
   $file_contents = curl_exec($ch);
   curl_close($ch);
   return $file_contents;
}

echo post($url);
?>

签名规则(config.php文件代码查看)

http://dev.polyv.net/2018/liveproduct/l-api/rule/sign/

以上内容是否对您有帮助?根本没有帮助文档较差文档一般文档不错文档很好
Loading...

添加单个白名单

接口URL

https://api.polyv.net/live/v3/channel/auth/add-white-list

接口说明

1、作用:用于添加单个观看白名单
2、接口支持https协议

返回结果支持格式

JSON

请求方式

POST

请求数限制

TRUE

请求参数

参数名 必选 类型 说明
appId string 从API设置中获取,在直播系统登记的appId
timestamp string 当前时间的秒级时间戳(13位)
sign string 签名,为32位大写的MD5值
channelId int 频道号(传频道号则添加频道观看白名单,不传频道号则添加全局观看白名单)
rank int 主要观看条件为1,次要观看条件为2
code string 会员码(最多为50个字符)
name string 昵称(最多为50个字符)

操作成功响应示例

{
  "code": 200,
  "message": "",
  "status": "success",
  "data": "success"
}

操作失败响应示例

签名错误

{
    "code": 403,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}

缺少参数

{
    "code": 400,
    "status": "error"
    "message": "param should not be empty: name",
    "data": ""
}

参数长度过长

{
    "code": 400,
    "status": "error"
    "message": "param length is incorrect: name",
    "data": ""
}

参数类型错误

{
    "code": 400,
    "status": "error"
    "message": "param validate error",
    "data": ""
}

白名单会员码已存在

{
    "code": 400,
    "status": "error"
    "message": "whitelist code exist",
    "data": ""
}

白名单昵称已存在

{
    "code": 400,
    "status": "error"
    "message": "whitelist name exist",
    "data": ""
}

响应字段说明

名称 类型 说明
code string 响应代码,成功为200,失败为400,签名错误为401,异常错误500
status string 成功为success,失败为error
message string 错误时为错误提示消息
data string 成功返回信息

php请求示例

<?php
//引用config.php
include 'config.php';

$params = array(
  'appId' => $appId,
  'timestamp' => $timestamp,
  'channelId' => '123456',
  'name' => '昵称123',
  'code' => '会员码123',
  'rank' => '1'
  )

//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法

$params["sign"] = $sign;
$url="https://api.polyv.net/live/v3/channel/auth/add-white-list?".http_build_query($params);

function post($url, $post_data = '', $timeout = 5){
   $ch = curl_init();
   curl_setopt ($ch, CURLOPT_URL, $url);
   curl_setopt ($ch, CURLOPT_POST, 1);
   if($post_data != ''){
      curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);
   }

   curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
   curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
   curl_setopt($ch, CURLOPT_HEADER, false);
   curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . strlen($post_data)));
   $file_contents = curl_exec($ch);
   curl_close($ch);
   return $file_contents;
}

echo post($url);
?>

签名规则(config.php文件代码查看)

http://dev.polyv.net/2018/liveproduct/l-api/rule/sign/

以上内容是否对您有帮助?根本没有帮助文档较差文档一般文档不错文档很好
Loading...

查询课件重制任务列表

接口URL

http://api.polyv.net/live/v3/channel/pptRecord/list

接口说明

1、接口用于查询课件重制任务列表
2、接口支持https

返回结果支持格式

JSON

请求方式

GET

请求数限制

TRUE

请求参数

参数名 必选 类型 说明
appId string 从API设置中获取,在直播系统登记的appId
timestamp long 13位当前时间戳
sign string 签名值
channelId int 频道号
sessionId string 场次id
status string 状态值。waiting-等待处理,process-处理中,success-重制成功,fail-重制失败,uploaded-上传点播成功,uploadFailed-上传点播失败
startTime string 直播开始时间开始区间,格式为yyyyMMddHHmmss
endTime string 直播开始时间结束区间,格式为yyyyMMddHHmmss
page int 分页页码
pageSize int 分页大小

响应成功JSON示例:

{
    "code": 200,
    "status": "success",
    "message": "",
    "data": {
        "pageNumber": 1,
        "totalPages": 8,
        "pageSize": 1,
        "contents": [
            {
                "channelId": 206204,
                "title": "test",
                "url": "http://playback.videocc.net/transform/a2c7d0ed37_0.mp4?auth_key=1577427993-0-0-d469619bbb434240c3e88aeadbbbcd2c",
                "sessionId": "fix2p01fiz",
                "startTime": "20191220000012",
                "status": "success",
                "remainDay": 178,
                "duration": 25
            }
        ]
    }
}

响应字段说明

参数名 说明
code 状态码,成功为200,签名失败为403,参数错误为400,服务端错误为500
status 成功为success,错误时为error
message 成功为"",错误时为错误描述信息
data 重制任务分页列表数据
pageNumber 当前页码
totalPages 总页数
pageSize 页面大小
contents 任务列表
channelId 频道号
title 对应回放的名称
url 重制mp4下载地址,有24小时的防盗链超时时间
sessionId 场次id
startTime 对应回放的直播开始时间,格式为yyyyMMddhhmmss
status 状态值。waiting-等待处理,process-处理中,success-重制成功,fail-重制失败,uploaded-上传点播成功,uploadFailed-上传点播失败
remainDay 重制剩余的过期时间,过期后将无法访问和下载
duration 重制的视频时长,单位秒

响应失败JSON示例:

参数错误

{
    "code": 400,
    "status": "error",
    "message": "param validate error",
    "data": 400
}

未输入appId

{
    "code": 400,
    "status": "error",
    "message": "appId is required.",
    "data": ""
}

appId不正确

{
    "code": 400,
    "status": "error",
    "message": "application not found.",
    "data": ""
}

时间戳错误

{
    "code": 400,
    "status": "error",
    "message": "invalid timestamp.",
    "data": ""
}

签名错误

{
    "code": 403,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}

php请求示例

<?php
//引用config.php
include 'config.php';

$params = array(
  'appId' => $appId,
  'timestamp' => $timestamp,
  'channelId' => 206204
);

//生成sign
$sign = getSign($params); //详细查看config.php文件的getSign方法
$params['sign'] = $sign;

$url = "http://api.polyv.net/live/v3/channel/pptRecord/list?".http_build_query($params);

$curl = curl_init();
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
curl_setopt($curl, CURLOPT_TIMEOUT, 500);
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_POST, 1);
$res = curl_exec($curl);
curl_close($curl);

echo $res;
?>

签名规则(config.php文件代码查看)

http://dev.polyv.net/2018/liveproduct/l-api/rule/sign/

以上内容是否对您有帮助?根本没有帮助文档较差文档一般文档不错文档很好
Loading...

导出频道单场抽奖的中奖记录

接口URL

http://api.polyv.net/live/v3/channel/lottery/download-winner-detail

接口说明

1.导出频道的单场抽奖的中奖记录
2.导出表格格式可具体参考直播后台的导出中奖记录功能
3.接口支持https

请求方式

GET

请求参数

参数名 必选 类型及范围 说明
sign true string 校验签名
appId true string 开发者账号下的appId
timestamp true string 13位当前时间的时间戳
channelId true int 频道号
lotteryId true string 抽奖ID

返回正确结果JSON示例

响应成功时,接口将返回文件流,格式为.xls,内容为导出的中奖记录数据。

响应失败JSON示例:

未输入appId

{
    "code": 400,
    "status": "error",
    "message": "appId is required.",
    "data": ""
}

appId不正确

{
    "code": 400,
    "status": "error",
    "message": "application not found.",
    "data": ""
}

时间戳错误

{
    "code": 400,
    "status": "error",
    "message": "invalid timestamp.",
    "data": ""
}

签名错误

{
    "code": 403,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}

频道不存在

{
    "code": 404,
    "status": "error",
    "message": "channel not found.",
    "data": ""
}

字段说明

参数名 说明
code 响应代码,失败为400,签名错误为401,异常错误500
status 成功为success,失败为error
message 错误时为错误提示消息
data 错误时为空串

PHP请求示例

<?php

//引用config.php
include 'config.php';

$channelId = "322120";
$params = array(
        'appId'=>$appId,
        'lotteryId'=>"ff9yv31sud",
        'channelId'=>$channelId,
        'timestamp'=>$timestamp
    );

//生成sign
$sign = getSign($params); //详细查看config.php文件
$params['sign'] = $sign;
$url="http://api.polyv.net/live/v3/channel/lottery/download-winner-detail?".http_build_query($params);
echo "<script>window.location.href='$url'</script>";
?>

签名规则(config.php文件代码查看)

http://dev.polyv.net/2018/liveproduct/l-api/rule/sign/

以上内容是否对您有帮助?根本没有帮助文档较差文档一般文档不错文档很好
Loading...

获取频道单场抽奖的中奖记录

接口URL

http://api.polyv.net/live/v3/channel/lottery/get-winner-detail

接口说明

1.获取频道的单场抽奖的中奖记录
2.接口支持https

请求方式

GET

请求参数

参数名 必选 类型及范围 说明
sign true string 校验签名
appId true string 开发者账号下的appId
timestamp true string 13位当前时间的时间戳
channelId true int 频道号
lotteryId true string 抽奖ID
page false int 查询的页数,默认为1
limit false int 查询的每页大小,默认为10

返回错误结果JSON示例

签名错误:
{
    "code": 403,
    "status": "error",
    "message": "invalid signature.",
    "data": ""
}
时间戳错误:
{
    "code": 400,
    "status": "error",
    "message": "invalid timestamp.",
    "data": ""
}

返回正确结果JSON示例

{
    "code": 200,
    "status": "success",
    "message": "",
    "data": {
        "pageSize": 10,
        "pageNumber": 1,
        "totalItems": 1,
        "contents": [
            {
                "recordId": "69aacfc0b7",
                "channelId": 108888,
                "lotteryId": "feb34vwxyd",
                "sessionId": "f6pxc1w8yb",
                "viewerId": "plk",
                "viewerName": "测试测试",
                "winnerCode": "789",
                "prize": "测试奖品",
                "name": null,
                "telephone": null,
                "createdTime": 1563763798000,
                "lastModified": 1563765266000,
                "address": null,
                "ext": "{\"receiveInfo\":[{\"field\":\"尊姓大名\",\"value\":\"测试测试\"},{\"field\":\"年龄\",\"value\":\"111\"},{\"field\":\"挖掘机技术哪家强\",\"value\":\"blueshit\"}]}"
            }
        ],
        "offset": 0,
        "limit": 1,
        "nextPageNumber": 1,
        "startRow": 1,
        "lastPage": true,
        "prePageNumber": 1,
        "firstPage": true,
        "totalPages": 1,
        "endRow": 1
    }
}
}

字段说明

字段 类型及范围 说明
code int 接口请求状态码,200表示成功
status string 接口请求状态,"success"表示成功
message string 请求失败时返回的错误信息
data Paginator<WinnerRecordModel> 中间记录的分页结果

数据对象字段说明

Paginator<WinnerRecordModel>

说明:抽奖记录的分页结果

字段 类型及范围 说明
pageNumber int 当前的页数
totalItems int 总记录数
firstPage boolean 是否为第一页,值为:true/false
lastPage boolean 是否为最后一页,值为:true/false
nextPageNumber int 下一页编号
prePageNumber int 上一页编号
totalPages int 总页数
startRow int 当前页第一条记录在总记录中的位置
endRow int 当前页最后一个记录在总记录中的位置
limit int 当前页记录个数
contents List<WinnerRecordModel> 中间记录列表
WinnerRecordModel

说明:抽奖记录

字段 类型及范围 说明
recordId string 中奖记录ID
channelId int 频道号
sessionId string 抽奖时的直播场次ID
lotteryId string 抽奖ID
viewerId string 中奖用户ID
viewerName string 中奖用户昵称
winnerCode string 中奖码
prize string 奖品名称
createdTime long 中奖时间
ext string json 格式的字符串,表示中奖记录的额外拓展信息,对应模型类:WinnerRecordModelExt
WinnerRecordModelExt

说明:中奖记录的拓展信息

字段 类型及范围 说明
receiveInfo List<ReceiveInfoFieldModel> 领奖人需要填写的兑奖信息
ReceiveInfoFieldModel

说明:中奖记录填写的领奖信息

字段 类型及范围 说明
field string 填写的字段名
value string 填写的字段值

PHP请求示例

<?php

//引用config.php
include 'config.php';

$channelId = "322120";
$params = array(
        'appId'=>$appId,
        'lotteryId'=>"ff9yv31sud",
        'channelId'=>$channelId,
        'timestamp'=>$timestamp
    );

//生成sign
$sign = getSign($params); //详细查看config.php文件
$params['sign'] = $sign;

$url="http://api.polyv.net/live/v3/channel/lottery/get-winner-detail?".http_build_query($params);

$ch = curl_init() or die ( curl_error() );
curl_setopt( $ch, CURLOPT_URL, $url);
curl_setopt ($ch, CURLOPT_CUSTOMREQUEST, "GET");
curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, 360);
$response = curl_exec ( $ch );
curl_close ( $ch );
echo $response;

?>

签名规则(config.php文件代码查看)

http://dev.polyv.net/2018/liveproduct/l-api/rule/sign/

以上内容是否对您有帮助?根本没有帮助文档较差文档一般文档不错文档很好
Loading...