我使用Dropbox API上传文件,但是我不知道如何将cURL转换为Wix提取。 这是Dropbox API cURL:
curl -X POST https://content.dropboxapi.com/2/files/upload \
--header "Authorization: Bearer " \
--header "Dropbox-API-Arg: {\"path\": \"/Homework/math/Matrices.txt\",\"mode\": \"add\",\"autorename\": true,\"mute\": false,\"strict_conflict\": false}" \
--header "Content-Type: application/octet-stream" \
--data-binary @local_file.txt
答案 0 :(得分:0)
我正在将文件视为图像并编写
fetch('https://content.dropboxapi.com/2/files/upload',{
method:"post",
body: blob,
headers:{
"Content-Type":"application/octet-stream",
"Authorization":"Bearer "+"<your token>",
"Dropbox-API-Arg": JSON.stringify({
"path":"/uploads/demo.jpg",
"mode":"add",
"autorename":true,
"mute":false,
"strict_conflict": false
})
}
}).then(response=>response.json())
.then(result=>console.log(result))
.catch(error=>console.error);