Discuss Dropbox Developer & API
when I try to hit https://content.dropboxapi.com/2/files/upload and get id from that for uploaded data I need URL so hit https://api.dropboxapi.com/2/sharing/get_file_metadata but getting 400 erro please let me know what is issue.
try{
var setFilePublicBody = {
"file": "id:5LsYZF1Brd8AAAAAAAAAQQ",
"actions": []
};
var xhr1 = new XMLHttpRequest();
xhr1.open("POST", "https://api.dropboxapi.com/2/sharing/get_file_metadata", true);
xhr1.setRequestHeader("Authorization", "Bearer " + storageSettings.api_token);
xhr1.setRequestHeader("Content-type", "application/json");
xhr1.setRequestHeader("Dropbox-API-Arg", '{"path": "' + path + '" ,"mode":"add","autorename":true,"mute":false,"strict_conflict":false}');
xhr1.send(setFilePublicBody );
if (xhr1.readyState === 4) {
console.log('success');
}
}catch(err){
console.log('url request......eroor =>'+err);
}
That error message indicates that the call failed because that /2/sharing/get_file_metadata endpoint doesn't support apps with the "app folder" access type, as noted in the documentation.
I don't have context on your use case, but for reference, if just you want to create a shared link for the uploaded file, you should use /2/sharing/create_shared_link_with_settings instead anyway. That is supported for apps with app folder access type.
Can you print out the response body? It should contain a more specific error message.
here is error i have received
That error message indicates that the call failed because that /2/sharing/get_file_metadata endpoint doesn't support apps with the "app folder" access type, as noted in the documentation.
I don't have context on your use case, but for reference, if just you want to create a shared link for the uploaded file, you should use /2/sharing/create_shared_link_with_settings instead anyway. That is supported for apps with app folder access type.
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!