Vimeo上传。无法获得complete_uri字段作为响应 [英] Vimeo uploading. Cannot get complete_uri field in response
本文介绍了Vimeo上传。无法获得complete_uri字段作为响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我上传到vimeo时,我一直在摆弄。
I've been fiddling quite a bit with my uploading to vimeo.
- 我已经提出了票证请求。
- 我上传了这个文件。
- 我已经检查了文件是否已上传。
- 我需要运行方法DELETE,我应该从我的票证中获得complete_uri响应。
但是,我没有收到机票响应中的任何complete_URI。
- I've made a ticket request.
- I've uploaded the file.
- I've checked the file if its uploaded.
- 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.
这是我的代码:
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
- 用户
- form
- ticket_id
- upload_link
- upload_link_secure
- uri
- user
为了完成我的工作上传我需要运行本指南中的第4步: https://developer.vimeo.com/api/upload
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();
推荐答案
目前,必须输入type = streaming请求的主体,而不是url参数。
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.
这篇关于Vimeo上传。无法获得complete_uri字段作为响应的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文