Your workflow is unique 👨💻 - tell us how you use Dropbox here.
Forum Discussion
Shilpa M.
9 years agoNew member | Level 1
Not getting response when I call "2/files/listfolder" method
Hi
I passed "https://api.dropboxapi.com/2/files/list_folder" to fetch files and folder from root.
and Passed parameters are:-
string path=string.empty;
request.AddHeader("Content-Type","appli...
Shilpa M.
9 years agoNew member | Level 1
Hi
I am using RestClient.
HTTP client is not overriding at my side. I got authorize and token successfully.
I am using following code for get list of folders:
RestClient restClient = new RestClient("https://api.dropboxapi.com");
private IRestResponse executeRequest(RestRequest request)
{
var iy = GetTokenInfo(ref status, ref errMsg);
if (status == "OK" && errMsg == ")
{
restClient.Authenticator = new HttpBasicAuthenticator(clientId, clientSecret);
}
request.AddHeader("Authorization", "Bearer " + accessToken);
request.AddHeader("Content-Type", "application/json");
return restClient.Execute(request);
}
private RestRequest FormRequest(RestType rtype, string data, Boolean useXML)
{
Method method;
switch (rtype)
{
case RestType.Get:
method = Method.GET;
break;
case RestType.Post:
method = Method.POST;
break;
case RestType.Put:
method = Method.PUT;
break;
case RestType.Delete:
method = Method.DELETE;
break;
default: return null;
}
RestRequest request = new RestRequest(data, method);
if (useXML)
request.AddHeader("Accept", "application/xml");
else
request.AddHeader("Accept", "application/json");
return request;
}
And list of folders:-
public string GetMetaData(string path, ref string status, ref string errMsg)
{
string responseStr = ";
string url = "/2/files/list_folder";
RestType type = RestType.Post;
Boolean useXml = false;
RestRequest request = FormRequest(type, url, useXml);
request.AddParameter("path", path);
//request.AddParameter("include_media_info", false);
//request.AddParameter("include_deleted", false);
IRestResponse response;
try
{
response = executeRequest(request);
responseStr = response.Content;
status = response.StatusDescription;
}
catch (Exception ex)
{
errMsg = ex.Message;
return null;
}
return responseStr;
}
And again I got same error as I sent to yesterday.
Please suggest me.
About Dropbox API Support and Feedback
Get help with the Dropbox API from fellow developers and experts.
The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.
If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.
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!