Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
Error in call to API function "files/get_thumbnail": HTTP header "Dropbox-API-Arg": could not decode input as JSON
here is code
var folder_flag = 0;
axios({
method: 'POST',
url: 'https://api.dropboxapi.com/2/files/list_folder',
headers: {
Authorization: 'Beareraccess_token',
'Content-Type': 'application/json'
},
data: {
path: "",
include_media_info: true
}
})
.then(function(response) {
console.log(response);
for (var i = 0; i < response.data.entries.length; i++) {
if (response.data.entries[i][".tag"] == "folder") {
folders.push(response.data.entries[i].name);
folder_flag = 1;
} else if (response.data.entries[i][".tag"] == "file") {
axios({
method: 'POST',
url: 'https://content.dropboxapi.com/2/files/get_thumbnail',
headers: {
Authorization: 'Bearer access_token',
'Content-Type': 'application/json',
'Dropbox-API-Arg': response.data.entries[i].id
}
})
.then(function(response) {
console.log(response);
file_flag = 1;
});
} else {
console.log('No File or Folder availabel right now');
}
[Cross-linking for reference: https://stackoverflow.com/questions/51614378/error-in-call-to-api-function-files-get-thumbnail-http-... ]
This error is indicating that the value you're sending in the "Dropbox-API-Arg" header isn't valid JSON. In your code, you're setting "Dropbox-API-Arg" to "response.data.entries[i].id", which isn't JSON. It's just a string with the ID for a file.
You can see an example of what this is supposed to be in the documentation for /2/files/get_thumbnail. You probably mean to do something like this:
'Dropbox-API-Arg': JSON.stringify({"path": response.data.entries[i].id})
JSONM stringify? .What the heck is that?. You cannot use that value in all languajes, please correct JSON decoding
@tridejur JSON.stringify is a method specific to JavaScript. This thread is about proper client-side handling of this API call in JavaScript, so this code is only relevant to JavaScript. Plese refer to the documentation for whatever language you're using for information on how to parse/write JSON.
There wasn't an issue with the server-side JSON decoding discovered in this thread. If you believe you've encountered an issue with the the server-side JSON decoding, please report the details in a new thread.
It was ust a missundrstanding in your json compiler.
Since it is working as expected, please test
http://tridejur.uy/t123.php?id=18711573&alta=2018-12-22blank13:15:12%27
And write me on 26045165, please extend my trial 30 days longer, since, I have not received any replies, I just got my credit card, but wanted to become a partner, if you decide not to provide free business account to my solution there is no problem as well but please send me a message to 26045165, createacc.bat does use create folder and upload.
@tridejur You already have an API support ticket open for this that we've been replying to. Please do not post in multiple places for the same issue. We'll continue following up with you on your ticket. Thanks!
Hi there!
If you need more help you can view your support options (expected response time for a ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!