使用Curl和Oauth 2将文件上传到DropBox的DropBox API PUT示例

问题描述:

我正在四处搜寻,但找不到合适的示例,也不熟悉能够通过文档进行分类。除了我向我展示的知识之外,还有其他知识如何为OAUTH 2形成CURL命令吗?而且我只需要OAUTH 2密钥吗?正在向我显示一个应用程序密钥,应用程序秘密和oauth2。如果需要,我正在perl脚本中使用它。

I am searching everywhere and haven't been able to locate a suitable example and am not well versed enough to be able to sort it out via the docs. Could someone with more knowledge than I show me how to form the CURL command for OAUTH 2? And is it that I only need the OAUTH 2 secret key? I am being shown an App key, app secret and oauth 2. I am using this in a perl script if it matters.

我找到的最近的代码是:

The closest code I have found is this:

 curl --request PUT --header "Content-Length: `ls -la jonathan.txt | awk '{ print $5}'`" --header         
 "Content-Type: multipart/mixed" --data-binary "@jonathan.txt" "https://api-    
 content.dropbox.com/1/files_put/dropbox/jonathan.txt?access_token=ABCDEF"

但我认为这不是OAUTH 2?

But I don't think that is OAUTH 2?

如果您有访问令牌(通过应用程序控制台创建):

If you have an access token (created via the app console):

curl -H "Authorization: Bearer <your token>" https://api-content.dropbox.com/1/files_put/auto/ -T <your file path>