我上传到
vimeo时,我一直在摆弄.
>我已经提出了票证请求.
>我上传了这个文件.
>我已经检查了文件是否已上传.
>我需要使用我应该从我的票证中获得的complete_uri响应来运行DELETE方法.
但是,我没有从故障单响应中收到任何complete_URI.
这是我的代码:
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;
}
这个回复给了我:
>形式
> ticket_id
> upload_link
> upload_link_secure
> uri
>用户
为了完成上传,我需要运行本指南中的第4步:https://developer.vimeo.com/api/upload
发送参数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();
最佳答案 目前,type = streaming必须在请求正文中发送,而不是作为url参数发送.
这可能会改变为允许任一选项.