11

I generated a public file request in Dropbox and would like to write some javascript code to programmatically upload a file which is generated on the flow (e.g. var myJsonString = JSON.stringify(myArray)) to the public folder.

As an example, I created this public folder:

https://www.dropbox.com/request/3gnn9m16eVCwxazuQIOF

2
  • [Cross-linking for reference: dropboxforum.com/t5/API-Support-Feedback/… ] Commented Jun 4, 2018 at 15:02
  • I've updated my answer below to to indicate there's no problem uploading to a public folder via the standard Dropbox REST API. Just use the list_folder API to retrieve the path for your folder and the upload API to upload your files. Commented Jun 8, 2018 at 15:51

1 Answer 1

7
+50

Since this is your Dropbox file request, you can use the standard Dropbox API to upload a file to this folder using an access token. There's no API to anonymously upload to some one else's file request folder as a public user would via the webpage, but because this is your folder, you can also make an API proxy to do this if you wanted such an API.

I've tested uploading to a File request folder with the API and it works fine.

Listing File Requests

You can retrieve a list of your file requests here using the 2/file_requests/list RPC API endpoint.

POST https://api.dropboxapi.com/2/file_requests/list

Like any Dropbox folder, you can upload to a file request via its file path specified by the destination property shown below.

{
  "file_requests":[
    {
      "id":"0123456789abcdefghi",
      "url":"https://www.dropbox.com/request/0123456789abcdefghi",
      "title":"My File Request",
      "destination":"/File requests/My File Request",
      "created":"2018-06-08T15:17:45Z",
      "is_open":true,
      "file_count":0
    }
  ]
}

Uploading Files

Once you have your specific file request folder, you can upload to it using the appropriate full path, e.g. /File requests/My File Request and use it in a standard RPC File Upload API call - /2/files/upload.

POST https://content.dropboxapi.com/2/files/upload

You will need to specify a path like /File requests/My File Request/My File.png via the Dropbox-API-Arg header as specified in the API Reference:

Web UI

Here's a screenshot of the public request root folder in the web UI home folder. The public request folder may change so it's a good idea to check the /2/file_requests/list API call specified above.

enter image description here

All File Request APIs

Here's a list of the Dropbox File Request specific APIs. As mentioned, you can use standard APIs against these folders and files as well.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.