Your workflow is unique 👨💻 - tell us how you use Dropbox here.
Forum Discussion
le h.
9 years agoNew member | Level 1
Error in call to API function “users/get_current_account”: Unexpected URL params: “access_token”
MainViewModel:
public async Task<string> Httpclient(string link,string oauthToken)
{
HttpClient client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", oauthToken);
HttpResponseMessage response = await client.PostAsync(link,new StringContent(""));
response.Content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
return await response.Content.ReadAsStringAsync();
}
Get_account_ViewModel:
public class Get_Current_Account_ViewModel
{
MainViewModel mainViewModel = new MainViewModel();
public async Task<Model.Get_Current_Account.RootObject> get_current_account(string _accessToken)
{
var query = await mainViewModel.Httpclient("https://api.dropboxapi.com/2/users/get_current_account?access_token=_accessToken",_accessToken);
if (query != null)
{
var get_data = JsonConvert.DeserializeObject<Model.Get_Current_Account.RootObject>(query);
return get_data;
}
else
return null;
}
I tried on two ways:
- the first way: I got a problem is
Error in call to API function "users/get_current_account": Unexpected URL params: "access_token" on Dropbox API
at
var query = await mainViewModel.Httpclient("https://api.dropboxapi.com/2/users/get_current_account?access_token=_accessToken",_accessToken);
- second way: Error in call to API function "users/get_current_account": Bad HTTP "Content-Type" header: "text/plain; charset=utf-8". Expecting one of "application/json", "application/json; charset=utf-8", "text/plain; charset=dropbox-cors-hack". when I remove ?access_token=_accessToken at var query.
- four way:
-
HttpResponseMessage response = await client.PostAsync( link, new StringContent("", System.Text.Encoding.UTF8, "application/json")); Error in call to API function \"users/get_current_account\": request body: could not decode input as JSON –
Please everyone solve this problem. I can not fix it. thanks.
1 Reply
Replies have been turned off for this discussion
- Steve M.9 years ago
Dropbox Staff
Cross-linking with Stack Overflow: http://stackoverflow.com/questions/35387312/error-in-call-to-api-function-users-get-current-account-unexpected-url-params/35388273.
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!