How to upload video to favorite/playlist using gdata in objective c
Posted
by
Swati
on Stack Overflow
See other posts from Stack Overflow
or by Swati
Published on 2010-10-28T06:57:49Z
Indexed on
2011/01/14
5:53 UTC
Read the original article
Hit count: 273
hi, i am trying to upload a video to favorite in my account but it shows Invalid request Uri and status code =400
i dont understand how should i format my request
my code
NSURL *url = [NSURL URLWithString:
http://gdata.youtube.com/feeds/api/users/username/favorite];
ASIFormDataRequest *request = [ASIFormDataRequest requestWithURL:url];
[request setPostValue:@"gdata.youtube.com" forKey:@"Host"];
[request setPostValue:@"application/atom+xml" forKey:@"Content-Type"];
[request setPostValue:@"CONTENT_LENGTH" forKey:@"Content-Length"];
[request setPostValue:@"" forKey:@"AuthSubToken"];
[request setPostValue:@"2" forKey:@"GData-Version"];
[request setPostValue:developer_key forKey:@"X-GData-Key"];
[request setPostValue:xml_data forKey:@"API_XML_Request"];
[request setDelegate:self];
[request setDidFailSelector:@selector(requestFailed:)];
[request setDidFinishSelector:@selector(gotTheResponse:)];
[[networkQueue go];
i have auth token and developer key, VIDEO_ID.but m not sure how to pass xml data in post request:
<?xml version="1.0" encoding="UTF-8"?>
<entry xmlns="http://www.w3.org/2005/Atom">
<id>VIDEO_ID</id>
</entry>
NSString *xml_data = contains xml data in string form
© Stack Overflow or respective owner