我在接收订阅者视图时遇到问题。通过授权并收到访问令牌后,我想获取我的 youtube 频道的观看次数。但我从 Api 得到以下答案:
{
"error": {
"errors": [
{
"domain": "global",
"reason": "forbidden",
"message": "Forbidden"
}
],
"code": 403,
"message": "Forbidden"
在授权期间,我使用以下范围:
我对 Youtube 分析的请求:
$root = 'https://www.googleapis.com/youtube/analytics/v1/reports?';
$params = [
'ids' => 'channel=='.$my_channel_id,
'dimensions' => 'day,subscribedStatus',
'start-date' => $start_date,
'end-date' => $end_date,
'filters' => 'subscribedStatus==SUBSCRIBED',
'metrics' => 'views',
'access_token' => $my_access_token,
];
$prms = $params;
$params = http_build_query($params);
$request = $root.$params;
$res = $this->requestAPI($request);