0

I am trying to post a HTTP request to dropbox in this way:

//NSString *urlString = [NSString stringWithFormat:@"https://api.dropbox.com/1/oauth/request_token"];
NSString *urlString = [NSString stringWithFormat:@"https://api.dropbox.com/1/delta"];
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];


//post
[request setHTTPBody:postBody];

//get response
NSHTTPURLResponse* urlResponse = nil;  
NSError *error = [[NSError alloc] init];  
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&urlResponse error:&error];  
NSString *result = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
NSLog(@"Response Code: %d", [urlResponse statusCode]);
if ([urlResponse statusCode] >= 200 && [urlResponse statusCode] < 300) {
    NSLog(@"Response: %@", result);

    //here you get the response

}

The response should be a JSON string.

The parameters are here: https://www.dropbox.com/developers/core/api#delta

It gives parameters and version, but I don't know how to set them.

Alessandro
  • 3,859
  • 11
  • 58
  • 124
  • How can you mark this as "possible duplicate". It regards different parameters, different code, it is a different problem.. – Alessandro Mar 06 '13 at 16:02
  • My question asks for a help in setting the correct parameters for my solution, not for his – Alessandro Mar 06 '13 at 16:03
  • and yet, oddly enough, even though every single form on the web has different parameters, they all manage to work through HTTP POST.... it's the CONCEPT in that answer that matters. – Marc B Mar 06 '13 at 16:03
  • but how can you say, I read the answer and i didn't understand anything. How can it relate to my problem? – Alessandro Mar 06 '13 at 16:05
  • give a man a fish, he eats for a day. teach a man to fish, he's got food forever. learn to fish, instead of just wanting a free meal. – Marc B Mar 06 '13 at 16:10
  • ok, but can someone please explain how parameters work... – Alessandro Mar 06 '13 at 16:13
  • I went through the answers you marked as duplicate, but i can't understand how the whole process works... – Alessandro Mar 06 '13 at 16:19
  • When it says: cursor A string that is used to keep track of your current state. On the next call pass in this value to return delta entries that have been recorded since the cursor was returned. locale The metadata returned will have its size field translated based on the given locale. For more information see above. – Alessandro Mar 06 '13 at 16:21

0 Answers0