Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.
This repository was archived by the owner on Aug 12, 2025. It is now read-only.

.Net Youtube Analytics API Vague Error Message #355

@leijae

Description

@leijae

Using the .Net youtube analytics client, I get the following error when with the attached executed code. This query works in the "Try It" section of the Youtube Analytics and Reporting documenation

// ERROR MESSAGE
Google.Apis.Requests.RequestError
Required [400]
Errors [
Message[Required] Location[ - ] Reason[required] Domain[global]
]

// CODE BEGINS HERE
var youtubeAnalyticsService = new YouTubeAnalyticsService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "MyApp"
});

            var query = youtubeAnalyticsService.Reports.Query();
            query.EndDate = DateTime.Today.ToString("yyyy-MM-dd");
            query.StartDate = DateTime.Today.AddDays(-30).ToString("yyyy-MM-dd");
            query.Ids = "channel==MINE";
            query.Metrics = "views,comments,likes,dislikes,estimatedMinutesWatched,averageViewDuration,subscribersGained";
            query.Dimensions = "day";
            query.Sort = "day";

            var result = await youtubeAnalyticsService.Reports.Query().ExecuteAsync(); 

There doesn't seem to be any other way to assign values to the ReportsQuery object. Unless I'm missing something...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions