NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: Alberto on July 12, 2021, 12:34:35 PM

Title: Posting to Dropbox
Post by: Alberto on July 12, 2021, 12:34:35 PM
To upload a file to Dropbox using CURL:

curl -X POST https://content.dropboxapi.com/2/files/upload
--header "Authorization: Bearer TuToken"
--header "Dropbox-API-Arg: {\"path\": \"/Test.txt\"}"
--header "Content-Type: application/octet-stream"
--data-binary @Test.txt

No problem with the header but...
How to set the --data-binary @Test.txt in NT?

Im trying to use this instaed of NetDrive because I did not found a way to use it with a fixed Token
Besides... using CURL you can generate the file hyperlink, using:
curl -X POST https://api.dropboxapi.com/2/sharing/create_shared_link_with_settings --header "Authorization: Bearer TuToken" --header "Content-Type: application/json"  --data "{\"path\": \"/Test.pdf\",\"settings\": {\"requested_visibility\": \"public\"}}" > SharedHyperlink.Json

Thanks



Title: Re: Posting to Dropbox
Post by: Bruce on July 13, 2021, 07:52:24 PM
--data-binary @Test.txt

This is just the "postdata" part of the net web client. So use

  net.post(url,str)

where str is a stringTheory object containing the binary data you want to send (presumably the contents of a file, you loaded into str with str.loadfile)

Cheers
Bruce