public Int64 uploadLink(UploadLinkQuery query) { var url = apiUrl + "/api/upload/link.xml"; var signature = new UploadSignature(); signature = getUploadSignature(); var data = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<vzaar-api>" + "<link_upload>" + "<key>" + signature.key + "</key>" + "<guid>" + signature.guid + "</guid>" + "<url>" + query.url + "</url>" + "<encoding_params>" + "<title>" + query.title + "</title>" + "<description>" + query.description + "</description>" + "<size_id>" + query.size_id + "</size_id>" + "<bitrate>" + query.bitrate + "</bitrate>" + "<width>" + query.width + "</width>" + "<transcoding>" + query.transcoding.ToString().ToLower() + "</transcoding>" + "</encoding_params>" + "</link_upload>" + "</vzaar-api>"; var response = executeRequest(url, "POST", data); var doc = new XmlDocument(); doc.LoadXml(response); var videoId = Int64.Parse(doc.SelectSingleNode("//id").InnerText); return(videoId); }
public Int64 uploadLink(UploadLinkQuery query) { var url = apiUrl + "/api/upload/link.xml"; var signatureQuery = new UploadSignatureQuery(); signatureQuery.url = query.url; signatureQuery.multipart = true; var signature = new UploadSignature(); signature = getUploadSignature(signatureQuery); var data = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<vzaar-api>" + "<link_upload>" + "<key>" + signature.key + "</key>" + "<guid>" + signature.guid + "</guid>" + "<url>" + HttpUtility.HtmlEncode(query.url) + "</url>" + "<encoding_params>" + "<title>" + HttpUtility.HtmlEncode(query.title) + "</title>" + "<description>" + HttpUtility.HtmlEncode(query.description) + "</description>" + "<size_id>" + query.size_id + "</size_id>" + "<bitrate>" + query.bitrate + "</bitrate>" + "<width>" + query.width + "</width>" + "<transcoding>" + query.transcoding.ToString().ToLower() + "</transcoding>" + "</encoding_params>" + "</link_upload>" + "</vzaar-api>"; var response = executeRequest(url, "POST", data); var doc = new XmlDocument(); doc.LoadXml(response); var videoId = Int64.Parse(doc.SelectSingleNode("//id").InnerText); return videoId; }
public void linkUploadTest() { var url = "http://samples.mplayerhq.hu/MPEG-4/turn-on-off.mp4"; var title = String.Concat("api-net-lu-", this.RandomString(5)); var query = new UploadLinkQuery { title = title, url = url, description = ".net api test" }; var videoId = this.api.uploadLink(query); var vid = this.api.getVideoDetails(videoId); this.assertEqual(vid.videoStatus.id, 11, "linkUpload"); }