C # Vimeo Upload - not working

I am trying to upload a video to my professional Vimeo account using the Vimeo documentation at: https://developer.vimeo.com/api/upload/videos#upload-your-video

Just to try, I created a simple C # console application: I can get the upload_ticket file.

When I "PUT" the video using WebClient.UploadData the file is sent.

try
        {
            WebClient wc = new WebClient();
            wc.Headers.Clear();
            wc.Headers.Add("Authorization", "bearer xxxxxxxxxxx");
            wc.Headers.Add("type", "streaming");                

            var vimeoTicket = JsonConvert.DeserializeObject<JObject>(wc.UploadString("https://api.vimeo.com/me/videos", "POST", ""));

            var file = File.ReadAllBytes(@"d:\3.mp4");

            wc.Headers.Clear();                

            var result= wc.UploadData(new Uri(vimeoTicket["upload_link_secure"].ToString()), "PUT", file);              

            WebClient wc1 = new WebClient();
            wc1.Headers.Clear();
            wc1.Headers.Add("Content-Range", "bytes */*");

            //This line will get me an execption {"The remote server returned an error: (308) Resume Incomplete."}
            var ff1 = wc1.UploadData(vimeoTicket["upload_link_secure"].ToString(), "PUT", new byte[0]);                
        }
        catch (Exception h)
        {

            throw;
        }

the doc API document says: "If this file exists, it will return a response with an HTTP status code of 308 and a Range header with the number of bytes on the server."

So why am I getting an exception without, and I am not getting any response, as in the document?

thanks

+4
source share
1 answer

- WebClient 308 , , , - WebClinet 308 ....

0

Source: https://habr.com/ru/post/1628394/


All Articles