0

I am not able to get any response from youtube analytics v1 API suddenly. It was working fine before.

Code -

string dimension = "country";
string requestedMetrics = "views,redViews,comments,likes,dislikes,videosAddedToPlaylists," +
            "videosRemovedFromPlaylists,shares,estimatedMinutesWatched,estimatedRedMinutesWatched," +
            "averageViewDuration,averageViewPercentage,cardClickRate,cardTeaserClickRate,cardImpressions," +
            "cardTeaserImpressions,cardClicks,cardTeaserClicks,subscribersGained,subscribersLost";

ReportsResource.QueryRequest result = this.analyticsService.Reports
            .Query("channel==MINE", this.reportDate.ToString("yyyy-MM-dd"), this.reportDate.ToString("yyyy-MM-dd"), requestedMetrics);
        result.Dimensions = dimension;
        if (!string.IsNullOrEmpty(videoId) && videoId.ToLower() != "all")
        {
            result.Filters = $"video=={videoId}";
        }

        Google.Apis.YouTubeAnalytics.v1.Data.ResultTable resultTable = result.Execute();

The scopes getting used -

string[] scopes = new string[] { YouTubeAnalyticsService.Scope.YtAnalyticsMonetaryReadonly, "https://www.googleapis.com/auth/youtube.readonly", "https://www.googleapis.com/auth/yt-analytics-monetary.readonly" };

I have seen youtube analytics v1 API will get deprecated on october 31st 2018. But till migration to v2 I need to fix the issue.

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
Anindita Ghatak
  • 163
  • 1
  • 3
  • 8
  • I have tried with analytics v2 api aswell. Still it's returning 0 rows. – Anindita Ghatak Sep 20 '18 at 23:49
  • If it was down you would be getting an error message. If the response is a null then there is no data for your request. Remove some of those metrics and try with only one. say views and see what happens. – Linda Lawton - DaImTo Sep 21 '18 at 07:29
  • Thank you for looking into. I have not got any error message. For simplicity, I have created a channel and uploaded a video. I have 4 views. I have tried this simple request, but still it's not returning any result - https://developers.google.com/apis-explorer/#p/youtubeAnalytics/v2/youtubeAnalytics.reports.query?dimensions=day&endDate=2018-09-21&ids=channel%253D%253DUCpV8LzmfVr-xiFHsuVEnO7Q&metrics=views&startDate=2018-09-21&_h=2& – Anindita Ghatak Sep 21 '18 at 08:08

1 Answers1

0

The issue you are probably having is that you are checking to soon Google apis exporer You will need to set the start day to two at least two days ago.

It normally takes 24 - 48 hours for data to be processed you cant see this information for today for example.

For my own channel i am seeing

 "rows": [
  [
   "2018-09-18",
   1
  ],
  [
   "2018-09-19",
   2
  ]

To day is 2018-09-21 the most recent date i can get is the 19th which is two days ago.

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449
  • Highly appreciate your help. I am able to see the result. – Anindita Ghatak Sep 23 '18 at 04:02
  • @DalmTo again I am seeing no result with another channel. Tried to fetch even I month old data too ,but didn't work. Source code - ReportsResource.QueryRequest result = this.analyticsService.Reports.Query(); result.StartDate = DateTime.Now.AddDays(-30).ToString("yyyy-MM-dd"); result.EndDate = DateTime.Now.AddDays(-29).ToString("yyyy-MM-dd"); result.Ids = "channel==MINE"; result.Dimensions = "day"; result.Metrics = "views,redViews"; result.Filters = $"video==all"; var resultTable = result.Execute(); – Anindita Ghatak Jun 22 '20 at 06:13