Vimeo uploading. Cannot get complete_uri field in response

為{幸葍}努か 提交于 2019-12-23 15:11:40

问题


I've been fiddling quite a bit with my uploading to vimeo.

  1. I've made a ticket request.
  2. I've uploaded the file.
  3. I've checked the file if its uploaded.
  4. I need to run the method DELETE with the complete_uri response i should get from my ticket. However, im not receiving any complete_URI from the ticket response.

Here is my code:

public static dynamic GenerateTicket()
        {
            const string apiUrl = "https://api.vimeo.com/me/videos?type=streaming";
            var req = (HttpWebRequest)WebRequest.Create(apiUrl);
            req.Accept = "application/vnd.vimeo.*+json;version=3.0";
            req.Headers.Add(HttpRequestHeader.Authorization, "bearer " + AccessToken);
            req.Method = "POST";
            var res = (HttpWebResponse)req.GetResponse();
            var dataStream = res.GetResponseStream();
            var reader = new StreamReader(dataStream);
            var result = Json.Decode(reader.ReadToEnd());

            return result;
        }

This response gives me:

  • form
  • ticket_id
  • upload_link
  • upload_link_secure
  • uri
  • user

In order to finish my upload i need to run step 4 in this guide: https://developer.vimeo.com/api/upload

Sending parameter type=streaming as body:

ASCIIEncoding encoding = new ASCIIEncoding();
            string stringData = "type=streaming"; //place body here
            byte[] data = encoding.GetBytes(stringData);

            req.Method = "PUT";
            req.ContentLength = data.Length;

            Stream newStream = req.GetRequestStream();
            newStream.Write(data, 0, data.Length);
            newStream.Close();

回答1:


At the moment, type=streaming must be sent in the body of the request, not as a url parameter.

This will probably change to allow either option.




回答2:


the important point is :

"The first thing you need to do is request upload access for your application. You can do so from your My Apps page."

If you get all values without complete_uri, it means: you dont have an upload access token. So go to your apps and make an upload request



来源:https://stackoverflow.com/questions/22662607/vimeo-uploading-cannot-get-complete-uri-field-in-response

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!