DropBox API PUT 使用 Curl 和 Oauth 2 将文件上传到 DropBox 的示例 [英] Example of DropBox API PUT using Curl and Oauth 2 to Upload a file to DropBox
问题描述
我到处搜索,但一直找不到合适的示例,而且我的技术还不够精通,无法通过文档对其进行整理.比我更有知识的人可以告诉我如何为 OAUTH 2 形成 CURL 命令吗?是不是我只需要 OAUTH 2 密钥?我看到了一个应用密钥、应用机密和 oauth 2.如果重要的话,我会在 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>
这篇关于DropBox API PUT 使用 Curl 和 Oauth 2 将文件上传到 DropBox 的示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!