I played a bit with loading in vimeo.
- I made a ticket request.
- I uploaded the file.
- I checked the file if I downloaded it.
- I need to run the DELETE method with the full response that I should get from my ticket. However, im does not get any full_URI from the response to the request.
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 answer gives me:
- The form
- ticket_id
- upload_link
- upload_link_secure
- uri
- User
To finish the download, I need to follow 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";
byte[] data = encoding.GetBytes(stringData);
req.Method = "PUT";
req.ContentLength = data.Length;
Stream newStream = req.GetRequestStream();
newStream.Write(data, 0, data.Length);
newStream.Close();
source
share