0

I am integrating dropbox in my app using OAuth 2.0 and now I want to upload a image using it's core api https://api-content.dropbox.com/1/files//

my problem is there is no parameter shown for file upload (where i can send NSData)

DropBox documentation link :- https://www.dropbox.com/developers/core/docs ( /files (POST) )

I don't want to upload file/image using DBRestClient because it requires two time of login one via webView (OAuth 2.0) and another one via it's internal framework and my app require OAuth 2.0 integration.

Anand Suthar
  • 3,678
  • 2
  • 30
  • 52

1 Answers1

1

Look closer. The documentation says:

Request body: "The file contents to be uploaded. Since the entire POST body will be treated as the file, any parameters must be passed as part of the request URL. The request URL should be signed just as you would sign any other OAuth request URL."

So you need to upload the actual contents through the message body (where the POST data would go).

However, the documentation also recommends to use /files_put instead.

Tobias
  • 7,723
  • 1
  • 27
  • 44
  • Yeah, really please use `/files_put`. Just do an HTTP PUT to `https://api-content.dropbox.com/1/files_put//` with the file contents as the body. Use an `Authorization` header of `Bearer `. – user94559 Nov 03 '13 at 08:57
  • yes i read that but i don't understand how to upload actual content through the message body. please post any example link for that I have never send content through message body. – Anand Suthar Nov 03 '13 at 09:00
  • 1
    You can find an example at http://stackoverflow.com/a/2347247/2948765 and more information in the official [documentation](https://developer.apple.com/library/ios/documentation/NetworkingInternetWeb/Conceptual/NetworkingOverview/WorkingWithHTTPAndHTTPSRequests/WorkingWithHTTPAndHTTPSRequests.html). – Tobias Nov 03 '13 at 09:12
  • Thanks still_learning for your reply now i can dot this stuff ..... thank you very much for your reply. – Anand Suthar Nov 03 '13 at 09:25