views:

92

answers:

0

Hi guys,

I'm trying to use ASIHTTPRequest to submit links to instapaper (http://www.instapaper.com/api).

I'm able to authenticate but I get a 400 response when trying to submit a link, so I'm clearly in need of figuring how to use postdata.

Any help appreciated. Sample code attached.

Thanks

NSURL *url = [NSURL URLWithString:urlInstapaperAddUrl];
ASIHTTPRequest *instapaperAuthRequest = [ASIHTTPRequest requestWithURL:url];
[instapaperAuthRequest setDelegate:self];
[instapaperAuthRequest setRequestMethod:@"PUT"];
NSData* temp = [[NSData alloc] initWithData:[@"url=http://www.redhat.com" dataUsingEncoding:NSASCIIStringEncoding]];
[instapaperAuthRequest appendPostData:temp];
[instapaperAuthRequest addBasicAuthenticationHeaderWithUsername:@"myusername" andPassword:@"mypassword"];
[instapaperAuthRequest startAsynchronous];