Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to create a request with ASIHttpRequest like the following?
    text
    copied!<p>I was woking on YouTube Resumable Uploads: <a href="https://developers.google.com/youtube/2.0/developers_guide_protocol_resumable_uploads#Sending_a_Resumable_Upload_API_Request" rel="nofollow">https://developers.google.com/youtube/2.0/developers_guide_protocol_resumable_uploads#Sending_a_Resumable_Upload_API_Request</a> </p> <p>I failed to create a request with ASIHttpRequest like the following. How to make it work? Thanks! Any help will be appreciated!</p> <p>(1)</p> <pre><code>POST /resumable/feeds/api/users/default/uploads HTTP/1.1 Host: uploads.gdata.youtube.com Authorization: Bearer ACCESS_TOKEN GData-Version: 2 X-GData-Key: key=adf15ee97731bca89da876c...a8dc Content-Length: 0 Slug: my_file.mp4 </code></pre> <p>(2)</p> <pre><code>POST /resumable/feeds/api/users/default/uploads HTTP/1.1 Host: uploads.gdata.youtube.com Authorization: Bearer ACCESS_TOKEN GData-Version: 2 X-GData-Key: key=adf15ee97731bca89da876c...a8dc Content-Length: 1941255 Slug: my_file.mp4 Content-Type: application/atom+xml; charset=UTF-8 &lt;?xml version="1.0"?&gt; &lt;entry xmlns="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/" xmlns:yt="http://gdata.youtube.com/schemas/2007"&gt; &lt;media:group&gt; &lt;media:title type="plain"&gt;Bad Wedding Toast&lt;/media:title&gt; &lt;media:description type="plain"&gt; I gave a bad toast at my friend's wedding. &lt;/media:description&gt; &lt;media:category scheme="http://gdata.youtube.com/schemas/2007/categories.cat"&gt;People &lt;/media:category&gt; &lt;media:keywords&gt;toast, wedding&lt;/media:keywords&gt; &lt;/media:group&gt; &lt;/entry&gt; </code></pre> <p>Here is my code for the (2) ,the request finished without error, but the responseData is empty.I don't know why!</p> <pre><code> NSURL *uploadUrl = [NSURL URLWithString:[NSString stringWithFormat:@"http://uploads.gdata.youtube.com/resumable/feeds/api/users/default/uploads"]]; ASIFormDataRequest *theRequest = [ASIFormDataRequest requestWithURL:uploadUrl]; NSString *xmlStr = [NSString stringWithFormat:@"&lt;?xml version=\"1.0\"?&gt;\n" @"&lt;entry xmlns=\"http://www.w3.org/2005/Atom\"\n" @"xmlns:media=\"http://search.yahoo.com/mrss/\"\n" @"xmlns:yt=\"http://gdata.youtube.com/schemas/2007\"&gt;\n" @"&lt;media:group&gt;\n" //Title @"&lt;media:title type=\"plain\"&gt;%@&lt;/media:title&gt;\n" //Description @"&lt;media:description type=\"plain\"&gt;\n" @"%@\n" @"&lt;/media:description&gt;\n" //Category @"&lt;media:category\n" @"scheme=\"http://gdata.youtube.com/schemas/2007/categories.cat\"&gt;Entertainment\n" @"&lt;/media:category&gt;\n" //Keywords @"&lt;media:keywords&gt;Camera,PowerCam&lt;/media:keywords&gt;\n" @"&lt;/media:group&gt;\n" @"&lt;/entry&gt;\n", @"PowerCam.mov",@"description" ]; [theRequest setTimeOutSeconds:60]; [theRequest addRequestHeader:@"Authorization" value:[NSString stringWithFormat:@"Bearer %@",_oauth.accessToken]]; [theRequest addRequestHeader:@"GData-Version" value:@"2"]; [theRequest addRequestHeader:@"X-GData-Key" value:[NSString stringWithFormat:@"key=%@", YouTuDevkey]]; [theRequest addRequestHeader:@"Content-Length" value:[NSString stringWithFormat:@"%d",xmlStr.length]]; [theRequest addRequestHeader:@"Slug" value:@"PowerCam.mov"]; [theRequest addRequestHeader:@"Content-Type" value:@"application/atom+xml; charset=UTF-8"]; [theRequest appendPostData:[xmlStr dataUsingEncoding:NSUTF8StringEncoding]]; [theRequest setUploadProgressDelegate:self]; theRequest.delegate = self; theRequest.tag = eWSKYouTubeSharerUploadingVideoMetadata; self.requestTag = eWSKYouTubeSharerUploadingVideoMetadata; self.request = theRequest; [[ASIManager manager] addRequest:theRequest]; [[ASIManager manager] startQueue]; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload