In WIX Backend, I'm struggling to find a way to upload a file to Dropbox using JS, fetch, etc.... I'm getting the following error. In addition where I need to mention the file I want to upload to Dropbox?
invalid json response body at https://content.dropboxapi.com/2/files/upload reason: Unexpected token E in JSON at position 0"
import { fetch } from 'wix-fetch';
export function xdrop() {
const url = "https://content.dropboxapi.com/2/files/upload";
const headers = {
"Authorization": "Bearer " + 'here I wrote of course my token code',
"Content-Type": "application/json",
"Dropbox-API-Arg": JSON.stringify({
"path": "/accwix.csv",
"mode": {
".tag": "add"
},
"autorename": true,
"mute": false
})
}
const request = {
"headers": headers,
}
console.log("request==>", request)
return fetch(url, request)
.then(response => response.json());
}