Need to see if your shared folder is taking up space on your dropbox 👨💻? Find out how to check here.
Forum Discussion
raysharp
8 years agoExplorer | Level 3
https://api.dropboxapi.com/2/users/get_space_usage no response
Hello. we use Dropbox HTTP V2 API to upload files . all it's ok. but. there is no response when send https://api.dropboxapi.com/2/users/get_space_usage post . we don't know why.
Greg-DB
Dropbox Community Moderator
8 years agoAre you seeing this for all accounts, or does this only seem to affect specific account(s)? If it's only affecting specific ones, please open an API ticket and share the account IDs for reference. Also, does the call eventually time out, and if so, what output do you get? Thanks in advance!
raysharp
8 years agoExplorer | Level 3
Thank you for your prompt reply.
It's not affect specific account(s) but for all accounts.
we use the same access token by
curl -X POST https://api.dropboxapi.com/2/users/get_space_usage --header "Authorization: Bearer <access token>
The dropbox server return right result.
and we use upload API
https://content.dropboxapi.com/2/files/upload
The dropbox server return 200 ok.
but only use API
https://api.dropboxapi.com/2/users/get_space_usage
The dropbox server have no reponse.
we wait for a long long time . there is nothing output .
PS. we use curl lib API send post.
- Greg-DB8 years ago
Dropbox Community Moderator
Thanks for the additional information. Since this is affecting all accounts, and the same endpoint works when using curl directly on the command line, it sounds like this is specific to how it's being called in your script using the curl lib API.
Can you share that script that has the issue so we can use it to reproduce the issue here? Thanks!- raysharp8 years agoExplorer | Level 3
static const char *DROPBOX_GET_CAPITY = "https://api.dropboxapi.com/2/users/get_space_usage";
static int dropbox_get_capity(const char *access_token)
{
char buffer[BUFF_SIZE] = {0};
long httpCode = 0;
CURLcode res;
if(!access_token)
return -1;
if (curl) {
struct curl_slist *headers = NULL; /* init to NULL is important */
snprintf(buffer, sizeof(buffer), "Authorization: Bearer %s", access_token);
headers = curl_slist_append(headers, buffer);
headers = curl_slist_append(headers, "Content-Type: ");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_URL, DROPBOX_GET_CAPITY);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, get_capity_cb);
curl_easy_setopt(curl, CURLOPT_POST, 1L);
/* Perform the request, res will get the return code */
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1L); // thread safe requirement
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
curl_easy_setopt(curl, CURLOPT_TIMEOUT, 10);
res = curl_easy_perform(curl); // will block here!!!
/* Check for errors */
if(res != CURLE_OK) {
fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpCode);
printf(" \nerr code httpcode == %ld \n", httpCode);
}
if (res == CURLE_OK) {
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &httpCode);
printf(" \nhttpcode == %ld \n", httpCode);
}
curl_slist_free_all(headers);
}
return (int)httpCode;
}if you need more code . I will share it. Thanks.
- Greg-DB8 years ago
Dropbox Community Moderator
Thanks! That's helpful. It looks like curl is waiting for the request body. Since this API call doesn't require one, you need to tell curl that, like this:
curl_easy_setopt(curl, CURLOPT_POST, 1L);
curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, 0);Or, you can send the JSON "null" in the body instead:
headers = curl_slist_append(headers, "Content-Type: application/json"); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "null");
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
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!