查询视频某个时段的播放流量统计数据

接口URL

https://api.polyv.net/v2/traffic/{userid}/video/{vid}

接口说明

查询给定的日期区间内视频每天消耗的流量
自2018年7月10日起,才可以统计到单个视频的移动端流量数据,在此之前没有移动端流量数据

支持格式

JSON

请求方式

GET

请求参数

参数名 必选 类型及范围 说明
userid true string 用户id,路径参数
vid true string 视频vid,路径参数
ptime true string 当前13位毫秒级时间戳,3分钟内有效
sign true string 签名,40位大写的sha1值
dr false string 时间段,具体值为以下几个:today(今天),yesterday(昨天),this_week(本周),last_week(上周),7days(最近7天),this_month(本月),last_month(上个月),this_year(今年),last_year(去年),默认值为7days
start false string 开始日期,格式为yyyy-MM-dd
end false string 结束日期,格式为yyyy-MM-dd

返回结果

{
  "code": 200, 
  "status": "success", 
  "message": "success", 
  "data": [
    {
      "currentDay": "2018-07-14", 
      "pcFlowSize": 0, 
      "mobileFlowSize": 0, 
      "totalFlowSize": 0
    }, 
    {
      "currentDay": "2018-07-15", 
      "pcFlowSize": 0, 
      "mobileFlowSize": 0, 
      "totalFlowSize": 0
    }, 
    {
      "currentDay": "2018-07-16", 
      "pcFlowSize": 0, 
      "mobileFlowSize": 0, 
      "totalFlowSize": 0
    }, 
    {
      "currentDay": "2018-07-17", 
      "pcFlowSize": 0, 
      "mobileFlowSize": 0, 
      "totalFlowSize": 0
    }, 
    {
      "currentDay": "2018-07-18", 
      "pcFlowSize": 0, 
      "mobileFlowSize": 0, 
      "totalFlowSize": 0
    }, 
    {
      "currentDay": "2018-07-19", 
      "pcFlowSize": 0, 
      "mobileFlowSize": 0, 
      "totalFlowSize": 0
    }, 
    {
      "currentDay": "2018-07-20", 
      "pcFlowSize": 0, 
      "mobileFlowSize": 0, 
      "totalFlowSize": 0
    }
  ]
}

失败返回json(不带jsonp)

{
  "code": 400,
  "status": "error",
  "message": "ptime is too old.",
  "data": ""
}

字段描述

字段名称 描述
currentDay 日期
pcFlowSize PC端消耗流量,单位字节
mobileFlowSize 移动端消耗流量,单位字节
totalFlowSize 总流量消耗,单位字节

响应说明

错误代码 message 说明
400 sign can not be empty. 加密串为空
400 vid invalid. 视频id错误
400 ptime is too old. 时间戳过期
400 ptime is illegal. 时间戳参数格式不对或者超过当前时间3分钟
400 Could not find user by userid. userid不存在
400 the sign is not right. 加密串不正确
401 start and end illegal. start日期大于end日期
500 query failed. 后台程序抛异常
200 success 提交成功

PHP请求示例

<?php
header("Content-type: text/html; charset=utf-8");
$userid="用户id";
$dr="7days";
$ptime=time()*1000;//13位
$secretkey="填写secretkey";
$str="dr=".$dr."&ptime=".$ptime.$secretkey;
$vid="b0f704132434cfe3fe8366c59f3875c0_b";

$hash=strtoupper(sha1($str));
$url="https://api.polyv.net/v2/traffic/$userid/video/$vid?ptime=$ptime&sign=$hash&dr=$dr";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$output = curl_exec($ch);
curl_close($ch);
//打印获得的数据
print_r($output);
?>

签名规则:

将非空的请求参数按照参数名字典顺序排列,连接参数名与参数值,并在尾部加上secretkey,生成40位大写SHA1值,作为sign。 以下是示例过程:

1、请求参数为

ptime = "1492591990000"
vid = "382839019131be68715e9455f8d0971a_3"
format = "json"

2、将请求参数按照参数名字典顺序排列

format = "json"
ptime = "1492591990000"
vid = "382839019131be68715e9455f8d0971a_3"

3、连接字符串
连接参数名与参数值,并在尾部加上secretkey(secretkey的值为tIQp4ATe9Z),如下:

format=json&ptime=1492591990000&vid=382839019131be68715e9455f8d0971a_3tIQp4ATe9Z

4、生成签名sign

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

查询单个视频的观看热点统计数据

接口URL

https://api.polyv.net/v2/videohot/{userid}

接口说明

按照日期区间或时间段查询单个视频的观看热点统计数据

支持格式

JSON

请求方式

GET

请求参数

参数名 必选 类型及范围 说明
userid true string 用户id,路径参数
ptime true string 当前13位毫秒级时间戳,3分钟内有效
sign true string 签名,40位大写的sha1值
vid true string 视频vid
dr false string 时间段,具体值为以下几个:today(今天),yesterday(昨天),this_week(本周),last_week(上周),7days(最近7天),this_month(本月),last_month(上个月),this_year(今年),last_year(去年),默认值为7days
start false string 开始日期,格式为yyyy-MM-dd
end false string 结束日期,格式为yyyy-MM-dd

返回结果

{
  "code": 200, 
  "status": "success", 
  "message": "success", 
  "data": [
    {
      "second": 1, 
      "viewcount": 0
    }, 
    {
      "second": 7, 
      "viewcount": 1
    }
  ]
}

失败返回json(不带jsonp)

{
  "code": 400,
  "status": "error",
  "message": "ptime is too old.",
  "data": ""
}

字段描述

字段名称 描述
second 视频时长
viewcount 播放量

响应说明

错误代码 message 说明
400 sign can not be empty. 加密串为空
400 vid invalid. 视频vid错误
400 ptime is too old. 时间戳过期
400 ptime is illegal. 时间戳参数格式不对或者超过当前时间3分钟
400 Could not find user by userid. userid不存在
400 the sign is not right. 加密串不正确
401 start and end illegal. start日期大于end日期
500 query failed. 后台程序抛异常
200 success 提交成功

PHP请求示例

<?php
header("Content-type: text/html; charset=utf-8");
$userid="用户id";
$dr="this_year";
$vid="9f033b6d5bbc0e9230afae7c7c15d055_9";
$ptime=time()*1000;//13位
$secretkey="填写secretKey";
$str="dr=".$dr."&ptime=".$ptime."&vid=".$vid.$secretkey;

$hash=strtoupper(sha1($str));
$url="http://api.polyv.net/v2/videohot/$userid?ptime=$ptime&sign=$hash&dr=$dr&vid=$vid";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$output = curl_exec($ch);
curl_close($ch);
//打印获得的数据
print_r($output);
?>

签名规则:

将非空的请求参数按照参数名字典顺序排列,连接参数名与参数值,并在尾部加上secretkey,生成40位大写SHA1值,作为sign。 以下是示例过程:

1、请求参数为

ptime = "1492591990000"
vid = "382839019131be68715e9455f8d0971a_3"
format = "json"

2、将请求参数按照参数名字典顺序排列

format = "json"
ptime = "1492591990000"
vid = "382839019131be68715e9455f8d0971a_3"

3、连接字符串
连接参数名与参数值,并在尾部加上secretkey(secretkey的值为tIQp4ATe9Z),如下:

format=json&ptime=1492591990000&vid=382839019131be68715e9455f8d0971a_3tIQp4ATe9Z

4、生成签名sign

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

查询视频的观看比例统计数据

接口URL

https://api.polyv.net/v2/play-ratio/{userid}

接口说明

查询单个视频或全部视频在一定时间范围内的观看比例统计数据

支持格式

JSON

请求方式

GET

请求参数

参数名 必选 类型及范围 说明
userid true string 用户id,路径参数
ptime true string 当前13位毫秒级时间戳,3分钟内有效
sign true string 签名,40位大写的sha1值
vid false string 视频vid,不填为查询用户维度
dr false string 时间段,具体值为以下几个:today(今天),yesterday(昨天),this_week(本周),last_week(上周),7days(最近7天),this_month(本月),last_month(上个月),this_year(今年),last_year(去年),默认值为7days
start false string 开始日期,格式为yyyy-MM-dd
end false string 结束日期,格式为yyyy-MM-dd

返回结果

{
  "code": 200, 
  "status": "success", 
  "message": "success", 
  "data": [
    {
      "percentage": "0-10", 
      "playCount": 13
    }, 
    {
      "percentage": "10-20", 
      "playCount": 7
    }, 
    {
      "percentage": "20-30", 
      "playCount": 1
    }, 
    {
      "percentage": "30-40", 
      "playCount": 1
    }, 
    {
      "percentage": "40-50", 
      "playCount": 3
    }, 
    {
      "percentage": "50-60", 
      "playCount": 1
    }, 
    {
      "percentage": "60-70", 
      "playCount": 1
    }, 
    {
      "percentage": "70-80", 
      "playCount": 0
    }, 
    {
      "percentage": "80-90", 
      "playCount": 0
    }, 
    {
      "percentage": "90-100", 
      "playCount": 0
    }
  ]
}

失败返回json(不带jsonp)

{
  "code": 400,
  "status": "error",
  "message": "ptime is too old.",
  "data": ""
}

字段描述

字段名称 描述
percentage 观看比例范围
playCount 观看数量

响应说明

错误代码 message 说明
400 sign can not be empty. 加密串为空
400 vid invalid. 视频id错误
400 ptime is too old. 时间戳过期
400 ptime is illegal. 时间戳参数格式不对或者超过当前时间3分钟
400 Could not find user by userid. userid不存在
400 the sign is not right. 加密串不正确
401 start and end illegal. start日期大于end日期
500 query failed. 后台程序抛异常
200 success 提交成功

PHP请求示例

<?php
header("Content-type: text/html; charset=utf-8");
$userid="用户id";
$dr="7days";
$ptime=time()*1000;//13位
$secretkey="填写secretkey";
$vid="视频vid";
$str="dr=".$dr."&ptime=".$ptime."&vid=".$vid.$secretkey;

$hash=strtoupper(sha1($str));
$url="http://api.polyv.net/v2/play-ratio/$userid?ptime=$ptime&sign=$hash&dr=$dr&vid=$vid";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$output = curl_exec($ch);
curl_close($ch);
//打印获得的数据
print_r($output);
?>

签名规则:

将非空的请求参数按照参数名字典顺序排列,连接参数名与参数值,并在尾部加上secretkey,生成40位大写SHA1值,作为sign。 以下是示例过程:

1、请求参数为

ptime = "1492591990000"
vid = "382839019131be68715e9455f8d0971a_3"
format = "json"

2、将请求参数按照参数名字典顺序排列

format = "json"
ptime = "1492591990000"
vid = "382839019131be68715e9455f8d0971a_3"

3、连接字符串
连接参数名与参数值,并在尾部加上secretkey(secretkey的值为tIQp4ATe9Z),如下:

format=json&ptime=1492591990000&vid=382839019131be68715e9455f8d0971a_3tIQp4ATe9Z

4、生成签名sign

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

查询视频的播放时长统计数据

接口URL

https://api.polyv.net/v2/play-duration/{userid}

接口说明

按照日期区间或时段查询视频播放时长统计数据

支持格式

JSON

请求方式

GET

请求参数

参数名 必选 类型及范围 说明
userid true string 用户id,路径参数
ptime true string 当前13位毫秒级时间戳,3分钟内有效
sign true string 签名,40位大写的sha1值
vid false string 视频vid,不传为查询用户级别统计
dr false string 时间段,具体值为以下几个:today(今天),yesterday(昨天),this_week(本周),last_week(上周),7days(最近7天),this_month(本月),last_month(上个月),this_year(今年),last_year(去年),默认值为7days
start false string 开始日期,格式为yyyy-MM-dd
end false string 结束日期,格式为yyyy-MM-dd

返回结果

{
  "code": 200, 
  "status": "success", 
  "message": "success", 
  "data": [
    {
      "currentDay": "2018-07-03", 
      "pcPlayDuration": 260, 
      "formatPcPlayDuration": "00:04:20", 
      "pcPlayDurationVideoAvg": 22, 
      "formatPcPlayDurationVideoAvg": "00:00:22", 
      "pcPlayDurationPersonAvg": 130, 
      "formatPcPlayDurationPersonAvg": "00:02:10", 
      "mobilePlayDuration": 0, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDurationVideoAvg": 0, 
      "formatMobilePlayDurationVideoAvg": "00:00:00", 
      "mobilePlayDurationPersonAvg": 0, 
      "formatMobilePlayDurationPersonAvg": "00:00:00"
    }, 
    {
      "currentDay": "2018-07-04", 
      "pcPlayDuration": 0, 
      "formatPcPlayDuration": "00:00:00", 
      "pcPlayDurationVideoAvg": 0, 
      "formatPcPlayDurationVideoAvg": "00:00:00", 
      "pcPlayDurationPersonAvg": 0, 
      "formatPcPlayDurationPersonAvg": "00:00:00", 
      "mobilePlayDuration": 0, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDurationVideoAvg": 0, 
      "formatMobilePlayDurationVideoAvg": "00:00:00", 
      "mobilePlayDurationPersonAvg": 0, 
      "formatMobilePlayDurationPersonAvg": "00:00:00"
    }, 
    {
      "currentDay": "2018-07-05", 
      "pcPlayDuration": 0, 
      "formatPcPlayDuration": "00:00:00", 
      "pcPlayDurationVideoAvg": 0, 
      "formatPcPlayDurationVideoAvg": "00:00:00", 
      "pcPlayDurationPersonAvg": 0, 
      "formatPcPlayDurationPersonAvg": "00:00:00", 
      "mobilePlayDuration": 0, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDurationVideoAvg": 0, 
      "formatMobilePlayDurationVideoAvg": "00:00:00", 
      "mobilePlayDurationPersonAvg": 0, 
      "formatMobilePlayDurationPersonAvg": "00:00:00"
    }
  ]
}

失败返回json(不带jsonp)

{
  "code": 400,
  "status": "error",
  "message": "ptime is too old.",
  "data": ""
}

字段描述

字段名称 描述
currentDay 日期
pcPlayDuration pc端播放时长,单位秒
formatPcPlayDuration 格式化的pc端播放时长
pcPlayDurationVideoAvg PC端视频平均播放时长,单位秒
formatPcPlayDurationVideoAvg 格式化的PC端视频平均播放时长
pcPlayDurationPersonAvg PC端人均播放时长,单位秒
formatPcPlayDurationPersonAvg 格式化的PC端人均播放时长
mobilePlayDuration 移动端播放时长,单位秒
formatMobilePlayDuration 格式化的移动端播放时长
mobilePlayDurationVideoAvg 移动端视频平均播放时长,单位秒
formatMobilePlayDurationVideoAvg 格式化后的移动端视频平均播放时长
mobilePlayDurationPersonAvg 移动端人均播放时长,单位秒
formatMobilePlayDurationPersonAvg 格式化的移动端人均播放时长

响应说明

错误代码 message 说明
400 sign can not be empty. 加密串为空
400 ptime is too old. 时间戳过期
400 ptime is illegal. 时间戳参数格式不对或者超过当前时间3分钟
400 Could not find user by userid. userid不存在
400 the sign is not right. 加密串不正确
401 start and end illegal. start日期大于end日期
500 query failed. 后台程序抛异常
200 success 提交成功

PHP请求示例

<?php
header("Content-type: text/html; charset=utf-8");
$userid="用户id";
$start="2018-07-03";
$end="2018-07-05";
$ptime=time()*1000;//13位
$secretkey="secretkey填写";
$str="end=".$end."&ptime=".$ptime."&start=".$start.$secretkey;

$hash=strtoupper(sha1($str));
$url="http://api.polyv.net/v2/play-duration/$userid?ptime=$ptime&sign=$hash&start=$start&end=$end";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$output = curl_exec($ch);
curl_close($ch);
//打印获得的数据
print_r($output);
?>

签名规则:

将非空的请求参数按照参数名字典顺序排列,连接参数名与参数值,并在尾部加上secretkey,生成40位大写SHA1值,作为sign。 以下是示例过程:

1、请求参数为

ptime = "1492591990000"
vid = "382839019131be68715e9455f8d0971a_3"
format = "json"

2、将请求参数按照参数名字典顺序排列

format = "json"
ptime = "1492591990000"
vid = "382839019131be68715e9455f8d0971a_3"

3、连接字符串
连接参数名与参数值,并在尾部加上secretkey(secretkey的值为tIQp4ATe9Z),如下:

format=json&ptime=1492591990000&vid=382839019131be68715e9455f8d0971a_3tIQp4ATe9Z

4、生成签名sign

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

查询视频终端环境统计数据

接口URL

https://api.polyv.net/v2/device/{userid}

接口说明

查询视频终端环境统计数据,包括浏览器环境,操作系统环境,终端环境

支持格式

JSON

请求方式

GET

请求参数

参数名 必选 类型及范围 说明
userid true string 用户id,路径参数
ptime true string 当前13位毫秒级时间戳,3分钟内有效
sign true string 签名,40位大写的sha1值
dr false string 时间段,具体值为以下几个:today(今天),yesterday(昨天),this_week(本周),last_week(上周),7days(最近7天),this_month(本月),last_month(上个月),this_year(今年),last_year(去年),默认值为7days
start false string 开始日期,格式为yyyy-MM-dd
end false string 结束日期,格式为yyyy-MM-dd

返回结果

{
  "code": 200, 
  "status": "success", 
  "message": "success", 
  "data": {
    "device": [
      {
        "deviceName": "PC端", 
        "videoView": 52, 
        "formatPlayDuration": "00:28:18", 
        "playDuration": 1698, 
        "uniqueViewer": 20, 
        "percentage": "89.66"
      }, 
      {
        "deviceName": "移动端", 
        "videoView": 6, 
        "formatPlayDuration": "00:03:25", 
        "playDuration": 205, 
        "uniqueViewer": 5, 
        "percentage": "10.34"
      }
    ], 
    "operatingSystem": [
      {
        "operateSystemName": "Windows", 
        "videoView": 40, 
        "formatPlayDuration": "00:23:58", 
        "playDuration": 1438, 
        "uniqueViewer": 18, 
        "percentage": "68.97"
      }, 
      {
        "operateSystemName": "Linux", 
        "videoView": 12, 
        "formatPlayDuration": "00:04:20", 
        "playDuration": 260, 
        "uniqueViewer": 2, 
        "percentage": "20.69"
      }, 
      {
        "operateSystemName": "Android Mobile", 
        "videoView": 6, 
        "formatPlayDuration": "00:03:25", 
        "playDuration": 205, 
        "uniqueViewer": 5, 
        "percentage": "10.34"
      }
    ], 
    "browser": [
      {
        "browserName": "Chrome", 
        "formatPcPlayDuration": "00:28:18", 
        "pcPlayDuration": 1698, 
        "pcVideoView": 52, 
        "pcUniqueViewer": 20, 
        "formatMobilePlayDuration": "00:00:00", 
        "mobilePlayDuration": 0, 
        "mobileVideoView": 0, 
        "mobileUniqueViewer": 0, 
        "pcPercentage": "100.00", 
        "mobilePercentage": "0.00"
      }, 
      {
        "browserName": "微信", 
        "formatPcPlayDuration": "00:00:00", 
        "pcPlayDuration": 0, 
        "pcVideoView": 0, 
        "pcUniqueViewer": 0, 
        "formatMobilePlayDuration": "00:03:25", 
        "mobilePlayDuration": 205, 
        "mobileVideoView": 6, 
        "mobileUniqueViewer": 5, 
        "pcPercentage": "0.00", 
        "mobilePercentage": "100.00"
      }
    ]
  }
}

失败返回json(不带jsonp)

{
  "code": 400,
  "status": "error",
  "message": "ptime is too old.",
  "data": ""
}

字段描述

字段名称 描述
device 终端环境统计数据
operatingSystem 操作系统环境统计数据
browser 浏览器环境统计数据
deviceName 终端环境名称,PC端或移动端
operateSystemName 操作系统环境名称
browserName 浏览器环境名称
percentage 总占比
videoView 视频总播放量
uniqueViewer 视频总观众数
playDuration 视频总播放时长
pcPlayDuration PC端播放时长,单位秒formatP
formatPcPlayDuration 格式化的PC播放时长,00:00:00
pcVideoView PC端播放量
pcUniqueViewer PC端唯一观众数
pcPercentage PC端数据占比
mobilePlayDuration 移动端播放时长,单位秒
formatMobilePlayDuration 格式化的移动端播放时长,00:00:00
mobileVideoView 移动端播放量
mobileUniqueViewer 移动端播放量
mobilePercentage 移动端数据占比

响应说明

错误代码 message 说明
400 sign can not be empty. 加密串为空
400 ptime is too old. 时间戳过期
400 ptime is illegal. 时间戳参数格式不对或者超过当前时间3分钟
400 Could not find user by userid. userid不存在
400 the sign is not right. 加密串不正确
401 start and end illegal. start日期大于end日期
500 query failed. 后台程序抛异常
200 success 提交成功

PHP请求示例

<?php
header("Content-type: text/html; charset=utf-8");
$userid="用户id";
$start="2018-01-01";
$end="2018-07-06";
$ptime=time()*1000;//13位
$secretkey="secretKey";
$str="end=".$end."&ptime=".$ptime."&start=".$start.$secretkey;

$hash=strtoupper(sha1($str));
$url="http://api.polyv.net/v2/device/$userid?ptime=$ptime&sign=$hash&start=$start&end=$end";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$output = curl_exec($ch);
curl_close($ch);
//打印获得的数据
print_r($output);
?>

签名规则:

将非空的请求参数按照参数名字典顺序排列,连接参数名与参数值,并在尾部加上secretkey,生成40位大写SHA1值,作为sign。 以下是示例过程:

1、请求参数为

ptime = "1492591990000"
vid = "382839019131be68715e9455f8d0971a_3"
format = "json"

2、将请求参数按照参数名字典顺序排列

format = "json"
ptime = "1492591990000"
vid = "382839019131be68715e9455f8d0971a_3"

3、连接字符串
连接参数名与参数值,并在尾部加上secretkey(secretkey的值为tIQp4ATe9Z),如下:

format=json&ptime=1492591990000&vid=382839019131be68715e9455f8d0971a_3tIQp4ATe9Z

4、生成签名sign

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

查询视频播放时段统计数据

接口URL

https://api.polyv.net/v2/hourly/{userid}

接口说明

查询视频播放时段统计数据

支持格式

JSON

请求方式

GET

请求参数

参数名 必选 类型及范围 说明
userid true string 用户id,路径参数
ptime true string 当前13位毫秒级时间戳,3分钟内有效
sign true string 签名,40位大写的sha1值
dr false string 时间段,具体值为以下几个:today(今天),yesterday(昨天),this_week(本周),last_week(上周),7days(最近7天),this_month(本月),last_month(上个月),this_year(今年),last_year(去年),默认值为7days
start false string 开始日期,格式为yyyy-MM-dd
end false string 结束日期,格式为yyyy-MM-dd

返回结果

{
  "code": 200, 
  "status": "success", 
  "message": "success", 
  "data": [
    {
      "currentHour": 0, 
      "formatPcPlayDuration": "00:00:00", 
      "pcPlayDuration": 0, 
      "pcFlowSize": 0, 
      "pcVideoView": 0, 
      "pcUniqueViewer": 0, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 1, 
      "formatPcPlayDuration": "00:00:00", 
      "pcPlayDuration": 0, 
      "pcFlowSize": 0, 
      "pcVideoView": 0, 
      "pcUniqueViewer": 0, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 2, 
      "formatPcPlayDuration": "00:00:00", 
      "pcPlayDuration": 0, 
      "pcFlowSize": 0, 
      "pcVideoView": 0, 
      "pcUniqueViewer": 0, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 3, 
      "formatPcPlayDuration": "00:00:00", 
      "pcPlayDuration": 0, 
      "pcFlowSize": 0, 
      "pcVideoView": 0, 
      "pcUniqueViewer": 0, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 4, 
      "formatPcPlayDuration": "00:00:00", 
      "pcPlayDuration": 0, 
      "pcFlowSize": 0, 
      "pcVideoView": 0, 
      "pcUniqueViewer": 0, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 5, 
      "formatPcPlayDuration": "00:00:00", 
      "pcPlayDuration": 0, 
      "pcFlowSize": 0, 
      "pcVideoView": 0, 
      "pcUniqueViewer": 0, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 6, 
      "formatPcPlayDuration": "00:00:00", 
      "pcPlayDuration": 0, 
      "pcFlowSize": 0, 
      "pcVideoView": 0, 
      "pcUniqueViewer": 0, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 7, 
      "formatPcPlayDuration": "00:00:00", 
      "pcPlayDuration": 0, 
      "pcFlowSize": 0, 
      "pcVideoView": 0, 
      "pcUniqueViewer": 0, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 8, 
      "formatPcPlayDuration": "00:00:00", 
      "pcPlayDuration": 0, 
      "pcFlowSize": 0, 
      "pcVideoView": 0, 
      "pcUniqueViewer": 0, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 9, 
      "formatPcPlayDuration": "00:12:11", 
      "pcPlayDuration": 731, 
      "pcFlowSize": 1503824, 
      "pcVideoView": 9, 
      "pcUniqueViewer": 5, 
      "formatMobilePlayDuration": "00:02:28", 
      "mobilePlayDuration": 148, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 2, 
      "mobileUniqueViewer": 2
    }, 
    {
      "currentHour": 10, 
      "formatPcPlayDuration": "00:00:25", 
      "pcPlayDuration": 25, 
      "pcFlowSize": 7048405, 
      "pcVideoView": 5, 
      "pcUniqueViewer": 5, 
      "formatMobilePlayDuration": "00:00:29", 
      "mobilePlayDuration": 29, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 2, 
      "mobileUniqueViewer": 2
    }, 
    {
      "currentHour": 11, 
      "formatPcPlayDuration": "00:02:08", 
      "pcPlayDuration": 128, 
      "pcFlowSize": 5549169, 
      "pcVideoView": 7, 
      "pcUniqueViewer": 6, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 12, 
      "formatPcPlayDuration": "00:00:00", 
      "pcPlayDuration": 0, 
      "pcFlowSize": 0, 
      "pcVideoView": 0, 
      "pcUniqueViewer": 0, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 13, 
      "formatPcPlayDuration": "00:00:14", 
      "pcPlayDuration": 14, 
      "pcFlowSize": 4640879, 
      "pcVideoView": 3, 
      "pcUniqueViewer": 2, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 14, 
      "formatPcPlayDuration": "00:02:53", 
      "pcPlayDuration": 173, 
      "pcFlowSize": 1633231, 
      "pcVideoView": 8, 
      "pcUniqueViewer": 4, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 15, 
      "formatPcPlayDuration": "00:01:24", 
      "pcPlayDuration": 84, 
      "pcFlowSize": 0, 
      "pcVideoView": 2, 
      "pcUniqueViewer": 2, 
      "formatMobilePlayDuration": "00:00:09", 
      "mobilePlayDuration": 9, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 1, 
      "mobileUniqueViewer": 1
    }, 
    {
      "currentHour": 16, 
      "formatPcPlayDuration": "00:00:34", 
      "pcPlayDuration": 34, 
      "pcFlowSize": 1461340, 
      "pcVideoView": 7, 
      "pcUniqueViewer": 2, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 17, 
      "formatPcPlayDuration": "00:02:12", 
      "pcPlayDuration": 132, 
      "pcFlowSize": 3809560, 
      "pcVideoView": 10, 
      "pcUniqueViewer": 4, 
      "formatMobilePlayDuration": "00:00:19", 
      "mobilePlayDuration": 19, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 1, 
      "mobileUniqueViewer": 1
    }, 
    {
      "currentHour": 18, 
      "formatPcPlayDuration": "00:06:17", 
      "pcPlayDuration": 377, 
      "pcFlowSize": 0, 
      "pcVideoView": 1, 
      "pcUniqueViewer": 1, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 19, 
      "formatPcPlayDuration": "00:00:00", 
      "pcPlayDuration": 0, 
      "pcFlowSize": 0, 
      "pcVideoView": 0, 
      "pcUniqueViewer": 0, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 20, 
      "formatPcPlayDuration": "00:00:00", 
      "pcPlayDuration": 0, 
      "pcFlowSize": 0, 
      "pcVideoView": 0, 
      "pcUniqueViewer": 0, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 21, 
      "formatPcPlayDuration": "00:00:00", 
      "pcPlayDuration": 0, 
      "pcFlowSize": 0, 
      "pcVideoView": 0, 
      "pcUniqueViewer": 0, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 22, 
      "formatPcPlayDuration": "00:00:00", 
      "pcPlayDuration": 0, 
      "pcFlowSize": 0, 
      "pcVideoView": 0, 
      "pcUniqueViewer": 0, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }, 
    {
      "currentHour": 23, 
      "formatPcPlayDuration": "00:00:00", 
      "pcPlayDuration": 0, 
      "pcFlowSize": 0, 
      "pcVideoView": 0, 
      "pcUniqueViewer": 0, 
      "formatMobilePlayDuration": "00:00:00", 
      "mobilePlayDuration": 0, 
      "mobileFlowSize": 0, 
      "mobileVideoView": 0, 
      "mobileUniqueViewer": 0
    }
  ]
}

失败返回json(不带jsonp)

{
  "code": 400,
  "status": "error",
  "message": "ptime is too old.",
  "data": ""
}

字段描述

字段名称 描述
currentHour 时段
pcPlayDuration pc播放时长,单位为秒
formatPcPlayDuration pc播放时长,格式为00:00:00
pcFlowSize pc消耗流量,单位为字节
pcVideoView pc端播放量
pcUniqueViewer pc端观众量
mobilePlayDuration 移动端播放时长,单位为秒
formatMobilePlayDuration 移动端播放时长,格式为00:00:00
mobileFlowSize 移动端消耗流量,单位为字节
mobileVideoView 移动端播放量
mobileUniqueViewer 移动端观众量

响应说明

错误代码 message 说明
400 sign can not be empty. 加密串为空
400 ptime is too old. 时间戳过期
400 ptime is illegal. 时间戳参数格式不对或者超过当前时间3分钟
400 Could not find user by userid. userid不存在
400 the sign is not right. 加密串不正确
401 start and end illegal. start日期大于end日期
500 query failed. 后台程序抛异常
200 success 提交成功

PHP请求示例

<?php
header("Content-type: text/html; charset=utf-8");
$userid="用户id";
$dr="this_year";
$start="2018-01-01";
$end="2018-07-06";
$ptime=time()*1000;//13位
$secretkey="填写secretkey";
$str="end=".$end."&ptime=".$ptime."&start=".$start.$secretkey;

$hash=strtoupper(sha1($str));
$url="http://api.polyv.net/v2/hourly/$userid?ptime=$ptime&sign=$hash&start=$start&end=$end";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$output = curl_exec($ch);
curl_close($ch);
//打印获得的数据
print_r($output);
?>

签名规则:

将非空的请求参数按照参数名字典顺序排列,连接参数名与参数值,并在尾部加上secretkey,生成40位大写SHA1值,作为sign。 以下是示例过程:

1、请求参数为

ptime = "1492591990000"
vid = "382839019131be68715e9455f8d0971a_3"
format = "json"

2、将请求参数按照参数名字典顺序排列

format = "json"
ptime = "1492591990000"
vid = "382839019131be68715e9455f8d0971a_3"

3、连接字符串
连接参数名与参数值,并在尾部加上secretkey(secretkey的值为tIQp4ATe9Z),如下:

format=json&ptime=1492591990000&vid=382839019131be68715e9455f8d0971a_3tIQp4ATe9Z

4、生成签名sign

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

查询视频观众量统计数据

接口URL

https://api.polyv.net/v2/data/visitor/{userid}

接口说明

按照日期区间或区段及视频ID查询视频的观众量统计数据,不传vid参数就表示查询用户下所有视频的观众量。

支持格式

JSON

请求方式

GET

请求参数

参数名 必选 类型及范围 说明
userid true string 用户id,路径参数
ptime true string 当前13位毫秒级时间戳,3分钟内有效
sign true string 签名,40位大写的sha1值
dr false string 时间段,具体值为以下几个:today(今天),yesterday(昨天),this_week(本周),last_week(上周),7days(最近7天),this_month(本月),last_month(上个月),this_year(今年),last_year(去年),默认值为7days
start false string 开始日期,格式为yyyy-MM-dd
end false string 结束日期,格式为yyyy-MM-dd
vid false string 单个视频ID

返回结果

{
"code": 200,
"status": "success",
"message": "success",
"data": [
{
"date": "2018-07-09",
"pcUniqueViewer": 0,
"mobileUniqueViewer": 0,
"totalUniqueViewer": 0
}
]
}

失败返回json(不带jsonp)

{
  "code": 400,
  "status": "error",
  "message": "ptime is too old.",
  "data": ""
}

字段描述

字段名称 描述
date 日期
pcUniqueViewer pc端的观看量
mobileUniqueViewer 移动端的观看量
totalUniqueViewer 总的观众量

响应说明

错误代码 message 说明
400 sign can not be empty. 加密串为空
400 ptime is too old. 时间戳过期
400 ptime is illegal. 时间戳参数格式不对或者超过当前时间3分钟
400 Could not find user by userid. userid不存在
400 the sign is not right. 加密串不正确
401 start and end illegal. start日期大于end日期
500 query failed. 后台程序抛异常
200 success 提交成功

PHP请求示例

<?php
header("Content-type: text/html; charset=utf-8");
$userid="用户id";
$dr="this_year";
$ptime=time()*1000;//13位
$secretkey="填写secretkey";
$str="dr=".$dr."&ptime=".$ptime.$secretkey;

$hash=strtoupper(sha1($str));
$url="http://api.polyv.net/v2/data/visitor/$userid?ptime=$ptime&sign=$hash&dr=$dr";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$output = curl_exec($ch);
curl_close($ch);
//打印获得的数据
print_r($output);
?>

签名规则:

将非空的请求参数按照参数名字典顺序排列,连接参数名与参数值,并在尾部加上secretkey,生成40位大写SHA1值,作为sign。 以下是示例过程:

1、请求参数为

ptime = "1492591990000"
vid = "382839019131be68715e9455f8d0971a_3"
format = "json"

2、将请求参数按照参数名字典顺序排列

format = "json"
ptime = "1492591990000"
vid = "382839019131be68715e9455f8d0971a_3"

3、连接字符串
连接参数名与参数值,并在尾部加上secretkey(secretkey的值为tIQp4ATe9Z),如下:

format=json&ptime=1492591990000&vid=382839019131be68715e9455f8d0971a_3tIQp4ATe9Z

4、生成签名sign

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

查询视频播放地理位置统计数据

接口URL

https://api.polyv.net/v2/geo/{userid}

接口说明

按照日期区间或区段查询视频播放地理位置统计数据

支持格式

JSON

请求方式

GET

请求参数

参数名 必选 类型及范围 说明
userid true string 用户id,路径参数
ptime true string 当前13位毫秒级时间戳,3分钟内有效
sign true string 签名,40位大写的sha1值
dr false string 时间段,具体值为以下几个:today(今天),yesterday(昨天),this_week(本周),last_week(上周),7days(最近7天),this_month(本月),last_month(上个月),this_year(今年),last_year(去年),默认值为7days
start false string 开始日期,格式为yyyy-MM-dd
end false string 结束日期,格式为yyyy-MM-dd

返回结果

{
code: 200,
status: "success",
message: "success",
data: [
{
province: "广东",
pcPlayDuration: 1698,
formatPcPlayDuration: "00:28:18",
pcFlowSize: 25646408,
pcVideoView: 52,
pcUniqueViewer: 20,
mobilePlayDuration: 205,
formatMobilePlayDuration: "00:03:25",
mobileFlowSize: 0,
mobileVideoView: 6,
mobileUniqueViewer: 5
}
]
}

失败返回json(不带jsonp)

{
  "code": 400,
  "status": "error",
  "message": "ptime is too old.",
  "data": ""
}

字段描述

字段名称 描述
province 省份
pcPlayDuration pc端播放时长,单位为秒
formatPcPlayDuration 播放时长,格式如00:00:00
pcFlowSize PC端消耗流量,单位字节
pcVideoView PC端播放量
pcUniqueViewer PC端观众量
mobilePlayDuration 移动端播放时长,单位为秒
formatMobilePlayDuration 移动端播放时长,格式如00:00:00
mobileFlowSize 移动端消耗流量,单位字节
mobileVideoView 移动端播放量
mobileUniqueViewer 移动端观众量

响应说明

错误代码 message 说明
400 sign can not be empty. 加密串为空
400 ptime is too old. 时间戳过期
400 ptime is illegal. 时间戳参数格式不对或者超过当前时间3分钟
400 Could not find user by userid. userid不存在
400 the sign is not right. 加密串不正确
401 start and end illegal. start日期大于end日期
500 query failed. 后台程序抛异常
200 success 提交成功

PHP请求示例

<?php
header("Content-type: text/html; charset=utf-8");
$userid="用户id";
$dr="this_year";
$ptime=time()*1000;//13位
$secretkey="填写secretkey";
$str="dr=".$dr."&ptime=".$ptime.$secretkey;

$hash=strtoupper(sha1($str));
$url="http://api.polyv.net/v2/geo/$userid?ptime=$ptime&sign=$hash&dr=$dr";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$output = curl_exec($ch);
curl_close($ch);
//打印获得的数据
print_r($output);
?>

签名规则:

将非空的请求参数按照参数名字典顺序排列,连接参数名与参数值,并在尾部加上secretkey,生成40位大写SHA1值,作为sign。 以下是示例过程:

1、请求参数为

ptime = "1492591990000"
vid = "382839019131be68715e9455f8d0971a_3"
format = "json"

2、将请求参数按照参数名字典顺序排列

format = "json"
ptime = "1492591990000"
vid = "382839019131be68715e9455f8d0971a_3"

3、连接字符串
连接参数名与参数值,并在尾部加上secretkey(secretkey的值为tIQp4ATe9Z),如下:

format=json&ptime=1492591990000&vid=382839019131be68715e9455f8d0971a_3tIQp4ATe9Z

4、生成签名sign

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

查询视频播放量统计数据接口

接口URL

http://api.polyv.net/v2/videoview/{userid}

接口说明

查询视频播放量统计数据接口

支持格式

JSON

请求方式

GET

请求参数

参数名 必选 类型及范围 说明
vid false string 视频ID,不填vid会查所有视频的播放量统计数据
userid true string 用户id(在url中使用,请求的时候不需要提交)
ptime true string 当前13位毫秒级时间戳,3分钟内有效
sign true string 签名,40位大写的sha1值
dr false string 时间段,具体值为以下几个:today(今天),yesterday(昨天),this_week(本周),last_week(上周),7days(最近7天),this_month(本月),last_month(上个月),this_year(今年),last_year(去年),默认值为7days
period false string 显示周期,具体为以下几个值:daily(按日显示),weekly(按周显示),monthly(按月显示)。默认值为daily。period的值受限于dr的值,当dr的值为today,yesterday,this_week,last_week,7days时,period只能为daily,当dr的值为this_month,last_month时,period只能为daily或者weekly

返回结果

{
  "code": 200,
  "status": "success",
  "message": "success",
  "data": [
    {
      "currentTime": "2018-02-23",
      "pcVideoView": 0,
      "mobileVideoView": 0
    },
    {
      "currentTime": "2018-02-24",
      "pcVideoView": 0,
      "mobileVideoView": 0
    },
    {
      "currentTime": "2018-02-25",
      "pcVideoView": 23,
      "mobileVideoView": 0
    },
    {
      "currentTime": "2018-02-26",
      "pcVideoView": 63,
      "mobileVideoView": 2
    },
    {
      "currentTime": "2018-02-27",
      "pcVideoView": 11,
      "mobileVideoView": 0
    },
    {
      "currentTime": "2018-02-28",
      "pcVideoView": 6,
      "mobileVideoView": 0
    },
    {
      "currentTime": "2018-03-01",
      "pcVideoView": 0,
      "mobileVideoView": 0
    }
  ]
}

失败返回json(不带jsonp)

{
  "code": 400,
  "status": "error",
  "message": "ptime is too old.",
  "data": ""
}

字段描述

字段名称 描述
currentTime 日期
pcVideoView pc端播放量
mobileVideoView 移动端播放量

响应说明

错误代码 message 说明
400 sign can not be empty. 加密串为空
400 ptime is too old. 时间戳过期
400 ptime is illegal. 时间戳参数格式不对或者超过当前时间3分钟
400 Could not find user by userid. userid不存在
400 the sign is not right. 加密串不正确
401 illegal vid. vid格式不正确,正确vid格式前面一段是userid
402 illegal period. period的值非法,请看请求参数里period的限制内容
500 query failed. 后台程序抛异常
200 success 提交成功

PHP请求示例

<?php
header("Content-type: text/html; charset=utf-8");
$userid="3828390191";
$dr="7days";
$period="daily";
$ptime=time()*1000;//13位
$vid="382839019131be68715e9455f8d0971a_3";
$secretkey="tIQp4ATe9Z";
//$jsonp="a";
if(empty($jsonp)){
    $str="dr=".$dr."&period=".$period."&ptime=".$ptime."&vid=".$vid.$secretkey;
}else{
    $str="dr=".$dr."&jsonp=".$jsonp."&period=".$period."&ptime=".$ptime."&vid=".$vid.$secretkey;
}
echo $str.'';
$hash=strtoupper(sha1($str));
echo $hash.'';
$url="http://api.polyv.net/v2/videoview/$userid?vid=$vid&ptime=$ptime&sign=$hash&dr=$dr&period=$period";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$output = curl_exec($ch);
curl_close($ch);
//打印获得的数据
print_r($output);
?>

签名规则:

将非空的请求参数按照参数名字典顺序排列,连接参数名与参数值,并在尾部加上secretkey,生成40位大写SHA1值,作为sign。 以下是示例过程:

1、请求参数为

ptime = "1492591990000"
vid = "382839019131be68715e9455f8d0971a_3"
format = "json"

2、将请求参数按照参数名字典顺序排列

format = "json"
ptime = "1492591990000"
vid = "382839019131be68715e9455f8d0971a_3"

3、连接字符串
连接参数名与参数值,并在尾部加上secretkey(secretkey的值为tIQp4ATe9Z),如下:

format=json&ptime=1492591990000&vid=382839019131be68715e9455f8d0971a_3tIQp4ATe9Z

4、生成签名sign

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

查询视频播放量排行接口

接口URL

http://api.polyv.net/v2/videoview/{userid}/ranklist

接口说明

查询视频播放量排行接口

支持格式

JSON

请求方式

GET

请求参数

参数名 必选 类型及范围 说明
userid true string 用户id(在url中使用,请求的时候不需要提交)
ptime true string 当前13位毫秒级时间戳,3分钟内有效
sign true string 签名,40位大写的sha1值
dr false string 时间段,具体值为以下几个:today(今天),yesterday(昨天),7days(最近7天),30days(最近30天),默认值为7days,当start和end都不为空时,dr失效,当start和end其中一个为空,查询最近7天数据,当start和end都为空,以dr为准
start false string 开始日期,格式为yyyy-MM-dd
end false string 结束日期,格式为yyyy-MM-dd

返回结果

{
  "code": 200,
  "status": "success",
  "message": "success",
  "data": {
    "totalMoVideoView": 0,
    "pcVideoDailys": [
      {
        "videoId": "cca90d24f79b99f93f34f7650aaad66f_c",
        "title": "Wildlife",
        "duration": "00:00:30",
        "pcVideoView": 1,
        "mobileVideoView": 0
      },
      {
        "videoId": "cca90d24f7815cedaf40a2c0bbed526c_c",
        "title": "Wildlife",
        "duration": "00:00:30",
        "pcVideoView": 1,
        "mobileVideoView": 0
      },
      {
        "videoId": "cca90d24f7352b354c2b6b335f218d3a_c",
        "title": "",
        "duration": "",
        "pcVideoView": 1,
        "mobileVideoView": 0
      }
    ],
    "moVideoDailys": [
      {
        "videoId": "cca90d24f79b99f93f34f7650aaad66f_c",
        "title": "Wildlife",
        "duration": "00:00:30",
        "pcVideoView": 1,
        "mobileVideoView": 0
      },
      {
        "videoId": "cca90d24f7815cedaf40a2c0bbed526c_c",
        "title": "Wildlife",
        "duration": "00:00:30",
        "pcVideoView": 1,
        "mobileVideoView": 0
      },
      {
        "videoId": "cca90d24f7352b354c2b6b335f218d3a_c",
        "title": "",
        "duration": "",
        "pcVideoView": 1,
        "mobileVideoView": 0
      }
    ],
    "totalPcVideoView": 3
  }
}

失败返回json(不带jsonp)

{
  "code": 400,
  "status": "error",
  "message": "ptime is too old.",
  "data": ""
}

字段描述

字段名称 描述
totalPcVideoView pc端总播放量
totalMoVideoView 移动端总播放量
pcVideoDailys pc端播放量排行列表
moVideoDailys 移动端播放量排行列表
videoId 视频vid
title 视频标题
duration 播放时长
pcVideoView pc端播放量
mobileVideoView 移动端播放量

响应说明

错误代码 message 说明
400 sign can not be empty. 加密串为空
400 ptime is too old. 时间戳过期
400 ptime is illegal. 时间戳参数格式不对或者超过当前时间3分钟
400 Could not find user by userid. userid不存在
400 the sign is not right. 加密串不正确
401 start and end illegal. start日期大于end日期
500 query failed. 后台程序抛异常
200 success 提交成功

PHP请求示例

<?php
header("Content-type: text/html; charset=utf-8");
$userid="3828390191";
$dr="7days";
$start="2017-12-30";
$end="2018-03-01";
$ptime=time()*1000;//13位
$secretkey="tIQp4ATe9Z";
//$jsonp="a";
if(empty($jsonp)){
    $str="dr=".$dr."&end=".$end."&ptime=".$ptime."&start=".$start.$secretkey;
}else{
    $str="dr=".$dr."&end=".$end."&jsonp=".$jsonp."&ptime=".$ptime."&start=".$start.$secretkey;
}
echo $str.'';
$hash=strtoupper(sha1($str));
echo $hash.'';
$url="http://api.polyv.net/v2/videoview/$userid/ranklist?ptime=$ptime&sign=$hash&dr=$dr&start=$start&end=$end";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$output = curl_exec($ch);
curl_close($ch);
//打印获得的数据
print_r($output);
?>

签名规则:

将非空的请求参数按照参数名字典顺序排列,连接参数名与参数值,并在尾部加上secretkey,生成40位大写SHA1值,作为sign。 以下是示例过程:

1、请求参数为

ptime = "1492591990000"
vid = "382839019131be68715e9455f8d0971a_3"
format = "json"

2、将请求参数按照参数名字典顺序排列

format = "json"
ptime = "1492591990000"
vid = "382839019131be68715e9455f8d0971a_3"

3、连接字符串
连接参数名与参数值,并在尾部加上secretkey(secretkey的值为tIQp4ATe9Z),如下:

format=json&ptime=1492591990000&vid=382839019131be68715e9455f8d0971a_3tIQp4ATe9Z

4、生成签名sign

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