1

I am creating an HTTP request. This is my request array where I set my method and my parameters:

...

 NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
 [request setURL:[NSURL URLWithString:urlString]];
  [request setHTTPMethod:@"POST"];

 //set headers

 [request addValue:@"OAuth oauth_version=\"1.0\"" forHTTPHeaderField: @"Authorization"];

 //create the body
NSMutableData *postBody = [NSMutableData data];

...

I know that the version is 1, the parameters are cursor and locale, and the method is POST see https://www.dropbox.com/developers/core/api#delta

The response I receive is 403 or 0, instead of a JSON string. Is this the right way to set parameters? What should I do?

user2014474
  • 1,117
  • 5
  • 19
  • 36
  • possible duplicate of [Append data to a POST NSUrlRequest](http://stackoverflow.com/questions/6148900/append-data-to-a-post-nsurlrequest) – trojanfoe Mar 06 '13 at 16:36
  • by following the answer I did: NSString *postString = @"cursor&locale!"; [request setHTTPBody:[postString dataUsingEncoding:NSUTF8StringEncoding]];...but it gives error 403 – user2014474 Mar 06 '13 at 16:49
  • I'm not too familiar with DropBox's authentication scheme, but maybe you can take a look at:http://stackoverflow.com/questions/1973325/nsurlconnection-and-basic-http-authentication – Rey Gonzales Mar 22 '13 at 15:17

1 Answers1

0

The 403 appears to be related the OAuth header.

Have you considered using the dropbox OAuth API's? https://www.dropbox.com/developers/core/sdk

If not it appears you need to use the following technique: https://www.dropbox.com/developers/blog/20