Open GoogleCodeExporter opened 9 years ago
Original comment by pele...@google.com
on 31 Jul 2014 at 2:49
I am having the same problem. The following c# code produces this problem:
var youtubeService = new YouTubeService(new BaseClientService.Initializer
{
HttpClientInitializer = new UserCredential
(
new GoogleAuthorizationCodeFlow
(
new GoogleAuthorizationCodeFlow.Initializer
{
ClientSecrets = new ClientSecrets
{
ClientId = "ClientId",
ClientSecret = "ClientSecret"
}
}
),
"user",
new TokenResponse
{
RefreshToken = "RefreshToken"
}
),
ApplicationName = "ApplicationName"
});
var videoData = File.OpenRead(@"VideoPath");
var request = youtubeService.Videos.Insert(new Video
{
Snippet = new VideoSnippet
{
Title = "Title",
Description = "Description"
},
Status = new VideoStatus
{
PrivacyStatus = "PrivacyStatus"
}
},
"snippet,status", videoData, "video/mp4");
request.ResponseReceived += results => Console.WriteLine(results);
var response = await request.UploadAsync();
Console.WriteLine(response.Exception);
The value for response.Exception is:
Value cannot be null.
Parameter name: baseUri
And the value for $exception is:
{"Response status code does not indicate success: 400 (Bad
Request)."} System.Exception {System.Net.Http.HttpRequestException}
And Fiddler shows:
POST
https://www.googleapis.com/upload/youtube/v3/videos?uploadType=resumable&part=sn
ippet%2Cstatus HTTP/1.1
X-Upload-Content-Type: video/mp4
X-Upload-Content-Length: 262712
User-Agent: Thuzi Video google-api-dotnet-client/1.9.0.26010 (gzip)
Authorization: Bearer ...
Content-Type: application/json; charset=utf-8
Host: www.googleapis.com
Content-Length: 79
Accept-Encoding: gzip, deflate
{"snippet":{"description":"","title":""},"status":{"privacyStatus":"unlisted"}}
HTTP/1.1 400 Bad Request
Vary: Origin
Vary: X-Origin
Content-Type: application/json; charset=UTF-8
Content-Length: 247
Date: Mon, 18 May 2015 14:49:23 GMT
Server: UploadServer ("Built on May 8 2015 11:09:05 (1431108545)")
Alternate-Protocol: 443:quic,p=1
{
"error": {
"errors": [
{
"domain": "youtube.video",
"reason": "invalidTitle",
"message": "Bad Request",
"locationType": "other",
"location": "body.snippet.title"
}
],
"code": 400,
"message": "Bad Request"
}
}
I would like to access to this error information so that I can display error
messages that make sense.
Original comment by csc...@thuzi.com
on 18 May 2015 at 3:06
I can only +1 this. Having the same problem. Trying to determine what wen't
wrong when I receive a GoogleApiException. The only message (except http status
code) I can get is something like this (which is hard to parse...)
"Google.Apis.Requests.RequestError\r\nBad Request [400]\r\nErrors
[\r\n\tMessage[Bad Request] Location[pageToken - parameter]
Reason[invalidPageToken] Domain[youtube.parameter]\r\n]\r\n"
http://stackoverflow.com/questions/30374997/google-client-library-for-net?noredi
rect=1#comment48879143_30374997
Original comment by joel.gu...@notified.com
on 22 May 2015 at 12:43
Original issue reported on code.google.com by
MikeMe...@gmail.com
on 15 Jul 2014 at 6:14