cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Share your feedback on the Document Scanning Experience in the Dropbox App right here.

Discuss Dropbox Developer & API

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Geeting error 400 for URL request

Geeting error 400 for URL request

ankitbhatii1108
New member | Level 2
Go to solution

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);
}

1 Accepted Solution

Accepted Solutions

Greg-DB
Dropbox Staff
Go to solution

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.

View solution in original post

4 Replies 4

Greg-DB
Dropbox Staff
Go to solution

Can you print out the response body? It should contain a more specific error message.

ankitbhatii1108
New member | Level 2
Go to solution

ankitbhatii1108_0-1624291049099.png

 

ankitbhatii1108
New member | Level 2
Go to solution

here is error i have received

Greg-DB
Dropbox Staff
Go to solution

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.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    ankitbhatii1108 New member | Level 2
What do Dropbox user levels mean?