• <tfoot id='EXYUB'></tfoot>
    <i id='EXYUB'><tr id='EXYUB'><dt id='EXYUB'><q id='EXYUB'><span id='EXYUB'><b id='EXYUB'><form id='EXYUB'><ins id='EXYUB'></ins><ul id='EXYUB'></ul><sub id='EXYUB'></sub></form><legend id='EXYUB'></legend><bdo id='EXYUB'><pre id='EXYUB'><center id='EXYUB'></center></pre></bdo></b><th id='EXYUB'></th></span></q></dt></tr></i><div id='EXYUB'><tfoot id='EXYUB'></tfoot><dl id='EXYUB'><fieldset id='EXYUB'></fieldset></dl></div>
    1. <legend id='EXYUB'><style id='EXYUB'><dir id='EXYUB'><q id='EXYUB'></q></dir></style></legend>

      <small id='EXYUB'></small><noframes id='EXYUB'>

          <bdo id='EXYUB'></bdo><ul id='EXYUB'></ul>

      1. Youtube Analytics API PHP 无效查询.查询不符合预期

        Youtube Analytics API PHP Invalid query. Query did not conform to the expectations(Youtube Analytics API PHP 无效查询.查询不符合预期)

        <small id='QAnTV'></small><noframes id='QAnTV'>

        1. <i id='QAnTV'><tr id='QAnTV'><dt id='QAnTV'><q id='QAnTV'><span id='QAnTV'><b id='QAnTV'><form id='QAnTV'><ins id='QAnTV'></ins><ul id='QAnTV'></ul><sub id='QAnTV'></sub></form><legend id='QAnTV'></legend><bdo id='QAnTV'><pre id='QAnTV'><center id='QAnTV'></center></pre></bdo></b><th id='QAnTV'></th></span></q></dt></tr></i><div id='QAnTV'><tfoot id='QAnTV'></tfoot><dl id='QAnTV'><fieldset id='QAnTV'></fieldset></dl></div>
              <legend id='QAnTV'><style id='QAnTV'><dir id='QAnTV'><q id='QAnTV'></q></dir></style></legend>

                <tfoot id='QAnTV'></tfoot>
                  <bdo id='QAnTV'></bdo><ul id='QAnTV'></ul>
                    <tbody id='QAnTV'></tbody>
                  本文介绍了Youtube Analytics API PHP 无效查询.查询不符合预期的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在尝试从服务器到服务器进行一些分析查询.我正在使用 laravel 和 https://github.com/google/google-api-php-客户端 库.

                  I'm trying to make some analytics query from server to server. I'm using laravel with https://github.com/google/google-api-php-client library.

                  这是我正在使用的代码:

                  This is the code I'm using:

                      $client = new Google_Client();
                  $key = file_get_contents(storage_path('key.p12'));
                  $cred = new Google_Auth_AssertionCredentials(
                          '***@developer.gserviceaccount.com', array('https://www.googleapis.com/auth/youtube.readonly', 'https://www.googleapis.com/auth/yt-analytics.readonly'), $key);
                  $client->setAssertionCredentials($cred);
                  if ($client->getAuth()->isAccessTokenExpired()) {
                      $client->getAuth()->refreshTokenWithAssertion($cred);
                  }
                  
                  Session::put('service_token', $client->getAccessToken());
                  
                  
                    $service = new Google_Service_YouTubeAnalytics($client);
                    $id = 'channel==MINE';
                    $start_date = '2014-05-01';
                    $end_date = '2014-06-30';
                  
                    $optparams = array(
                    'dimensions' => 'day',
                    'sort' => 'day,-views'
                    );
                  
                    $metric = 'views,estimatedMinutesWatched';
                  
                    $api = $service->reports->query($id, $start_date, $end_date, $metric, $optparams);
                  
                    $service = new Google_Service_YouTubeAnalytics($client);
                    $id = 'channel==MINE';
                    $start_date = '2014-05-01';
                    $end_date = '2014-06-30';
                  
                    $optparams = array(
                    'dimensions' => 'day',
                    'sort' => 'day,-views'
                    );
                  
                    $metric = 'views,comments,favoritesAdded,likes,dislikes,estimatedMinutesWatched,averageViewDuration';//'views,estimatedMinutesWatched';
                  
                    $api = $service->reports->query($id, $start_date, $end_date, $metric, $optparams);
                  

                  我的问题是身份验证工作正常,但我无法让分析查询开始工作,我收到以下错误:

                  My problem is that the authentication is working just fine, but I can't get the analytics query get to work, I'm getting the following error:

                  Error calling GET https://www.googleapis.com/youtube/analytics/v1/reports?ids=channel%3D%3DMINE&start-date=2014-05-01&end-date=2014-06-30&metrics=views%2CestimatedMinutesWatched&dimensions=day&sort=day%2C-views: (400) Invalid query. Query did not conform to the expectations. 
                  

                  即使在 API 资源管理器中运行相同的查询:https://developers.google.com/apis-explorer/#p/youtubeAnalytics/v1/youtubeAnalytics.reports.query?ids=channel%253D%253DMINE&start-date=2014-05-01&end-date=2014-06-30&metrics=views%252CestimatedMinutesWatched&dimensions=day&sort=day%252C-views&_h=1&

                  Even though the same exact query is working in the API explorer: https://developers.google.com/apis-explorer/#p/youtubeAnalytics/v1/youtubeAnalytics.reports.query?ids=channel%253D%253DMINE&start-date=2014-05-01&end-date=2014-06-30&metrics=views%252CestimatedMinutesWatched&dimensions=day&sort=day%252C-views&_h=1&

                  有什么想法吗?

                  推荐答案

                  我测试了您的查询,它运行良好,但显然 YouTube 不支持服务帐户.文档 说它应该返回一个 403case,但由于某种原因,它返回 400.

                  I tested your query and it's working fine, but apparently YouTube does not support service accounts. The documentation says it should return a 403 in this case, but for some reason it's returning 400.

                  这篇关于Youtube Analytics API PHP 无效查询.查询不符合预期的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  DeepL的翻译效果还是很强大的,如果我们要用php实现DeepL翻译调用,该怎么办呢?以下是代码示例,希望能够帮到需要的朋友。 在这里需要注意,这个DeepL的账户和api申请比较难,不支持中国大陆申请,需要拥有香港或者海外信用卡才行,没账号的话,目前某宝可以
                  PHP通过phpspreadsheet导入Excel日期,导入系统后,全部变为了4开头的几位数字,这是为什么呢?原因很简单,将Excel的时间设置问文本,我们就能看到该日期本来的数值,上图对应的数值为: 要怎么解决呢?进行数据转换就行,这里可以封装方法,或者用第三方的
                  mediatemple - can#39;t send email using codeigniter(mediatemple - 无法使用 codeigniter 发送电子邮件)
                  Laravel Gmail Configuration Error(Laravel Gmail 配置错误)
                  Problem with using PHPMailer for SMTP(将 PHPMailer 用于 SMTP 的问题)
                  Issue on how to setup SMTP using PHPMailer in GoDaddy server(关于如何在 GoDaddy 服务器中使用 PHPMailer 设置 SMTP 的问题)
                    1. <small id='xzpVm'></small><noframes id='xzpVm'>

                      <tfoot id='xzpVm'></tfoot>
                      <i id='xzpVm'><tr id='xzpVm'><dt id='xzpVm'><q id='xzpVm'><span id='xzpVm'><b id='xzpVm'><form id='xzpVm'><ins id='xzpVm'></ins><ul id='xzpVm'></ul><sub id='xzpVm'></sub></form><legend id='xzpVm'></legend><bdo id='xzpVm'><pre id='xzpVm'><center id='xzpVm'></center></pre></bdo></b><th id='xzpVm'></th></span></q></dt></tr></i><div id='xzpVm'><tfoot id='xzpVm'></tfoot><dl id='xzpVm'><fieldset id='xzpVm'></fieldset></dl></div>
                      <legend id='xzpVm'><style id='xzpVm'><dir id='xzpVm'><q id='xzpVm'></q></dir></style></legend>
                        <bdo id='xzpVm'></bdo><ul id='xzpVm'></ul>

                              <tbody id='xzpVm'></tbody>