Hi
I am getting this error - The requested URL /youtube/analytics/v1/reports/query was not found on this server. That’s all we know.
Below is the code
public void TrafficSearch()
{
var videoIds = new List();
var client = new RestClient("googleapis.com/youtube/analytics/v1/reports");
var request = new RestRequest("query", Method.GET);
request.AddParameter("channelId", "UCg3ZpKSH76ngG-m_nNVw");
request.AddParameter("metrics", "views");
request.AddParameter("dimensions", "insightTrafficSourceType,insightTrafficSourceDetail");
request.AddParameter("key", "AIzaSKSHGDTSGSFTRSG8");
request.AddParameter("type", "video");
request.AddParameter("maxResults", "50");
do
{
try
{
var videoListResponse = client.Execute(request);
Console.WriteLine(videoListResponse.Content);
dynamic videoListData = JsonConvert.DeserializeObject(videoListResponse.Content);
foreach (var item in videoListData.items)
{
videoIds.Add(item.id.videoId.ToString());
}
}
}
}
Thanks
Jignesh KumarPosted Apr 21, 2024, 4:41 AM
Hello Ramco,
You are missing https:// in your url, Please append suffix with https://
Sam HobbsPosted Apr 20, 2024, 9:12 PM
When I search the internet about
RestClient.ExecuteI find examples that include the protocol in the URL, as inhttps://googleapis.com/youtube/analytics/v1/reports.RestSharp In .NET 6.0
https://www.c-sharpcorner.com/article/restsharp-in-net-6-0
C# + RestSharp - HTTP POST Request Examples in .NET | Jason Watmore's Blog
https://jasonwatmore.com/c-restsharp-http-post-request-examples-in-net