I have an app that via Dropbox Javascript SDK trying to download the file. I don't have any idea what is wrong. Accessing Dropbox API via fetch calls directly bringing the same error. Dropbox API documentation saying that error 400 is for bad input parameters while it looks like what I'm sending is ok - "Dropbox-API-Arg":"{\"path\":\"/1/price.xlsx\"}"
const Dropbox = require("dropbox").Dropbox;
import axios from "axios";
import fs = require("fs");
import { logger } from "./logger";
export class FileHandler {
public async handle(path: string, token: string): Promise<void> {
try {
const dbx = new Dropbox({ fetch: axios, accessToken: token });
dbx.filesDownload({ path })
.then((data) => {
fs.writeFile(data.name, data.fileBinary, "binary", (err) => {
if (err) { throw err; }
});
})
.catch((error: any) => {
logger.error(error);
throw new Error(error);
});
} catch (err) {
logger.error(err);
}
}
}
curl -X POST https://content.dropboxapi.com/2/files/download --header "Authorization: Bearer <token>" --header "Dropbox-API-Arg: {\"path\": \"/1/price.xlsx\"}"
from terminal to see if the error is same – Bensky