I am trying to upload the document using Google API through my iPhone App. Here is the code which I am using:
NSString *authorizationHeader = [NSString stringWithFormat:@"GoogleLogin auth=\"%@\"" ,[another objectAtIndex:1]];
NSURL *url2 = [NSURL URLWithString:@"docs.google.com/feeds/documents/private/full"];
NSMutableURLRequest *urlRequest2 = [[NSMutableURLRequest alloc]initWithURL:url2];
[urlRequest2 setHTTPMethod:@"POST"];
[urlRequest2 setValue:@"2.0" forHTTPHeaderField:@"GData-Version"];
[urlRequest2 setValue:authorizationHeader forHTTPHeaderField:@"Authorization"];
[urlRequest2 setValue:Length forHTTPHeaderField:@"Content-Length"];
[urlRequest2 setValue:@"text/html" forHTTPHeaderField:@"Content-Type"];
[urlRequest2 setValue:slugStr forHTTPHeaderField:@"Slug"];
[urlRequest2 setHTTPBody:audioData];
Where authorizationHeader contains my GoogleLogin auth=theToken
By running this code I get the following response from the server
<HTML>
<HEAD> <TITLE>Token invalid</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Token invalid</H1>
<H2>Error 401</H2>
</BODY>
</HTML>
I don’t know where I am making the mistake. Is there an error in my header or am I passing the wrong parameters?
Shouldn’t the url in the is prefixed with http:// when creating the NSURL?