cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
Want to learn some quick and useful tips to make your day easier? Check out how Calvin uses Replay to get feedback from other teams at Dropbox here.

Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

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

Re: shared app directory, exists but inaccessible to my app

shared app directory, exists but inaccessible to my app

Mark L.45
Collaborator | Level 8

Created an app, linked to a specific directory. Lets call it acme. 

Create acme directory on my dropbox which I shared and placed some more directories and files within it.

Able to authenticate as the app using an HTTP API call.

But when I call the share files API call; I get an error, like it doesn't work. 

curl -X POST https://api.dropboxapi.com/2/sharing/list_shared_links  --header "Authorization: Bearer ab--AUTHCODE"  --header "Content-Type: application/json"  --data "{}"

Unable to list any files in this directory at all!!

Was using a more generic app access to all files in my dropbox, that let me list any directory. That worked like a charm, perfectly.

 

10 Replies 10

Rich
Super User II

Moved to the API forum.

Greg-DB
Dropbox Staff

Hi Mark, I'll be happy to help with this, but it's hard to follow without seeing the actual API calls you're making. Can you share the set of API calls, including both requests and responses, that show the issue? Just be sure to redact the access token (and any other private information). Thanks in advance! 

Mark L.45
Collaborator | Level 8

Hi Gregory, I think I have miss-understood a concept here. I create a app that has access across all my files on my dropbox and my app works. I create an app with limited access and I it doesn't. The app itself uses HTTP protocol, so calls much like the one above. After installation the app makes this call. 

https://www.dropbox.com/oauth2/authorize?client_id=ID&response_type=token&redirect_uri=https://www.d..." + String(token2Verify))

With a random token, it works and returns an access token I use. Later in the app I make a calls to this routine.

curl -X POST https://api.dropboxapi.com/2/sharing/list_shared_links  --header "Authorization: Bearer ab-CODE"  --header "Content-Type: application/json"  --data "{}"

And it returns nothing as you can see beyond a cursor suggesting there is more? This despite the fact that I have more than a 1000 files within directories in the app directory I named?

{"links": [], "has_more": true, "cursor": "cursor-CODE"}

I clearly missed a detail here? It works if I the app I create has access to all my files, but not if I restrict it to a directory?

 

Greg-DB
Dropbox Staff

When you say you created an app with "limited access", I presume you mean you registered an app with the app folder permission. When calling /sharing/list_shared_links with an app folder app, and not specifying a path parameter, it will only return shared links that exist for files that has access to, i.e., in its app folder.

The output you shared, with an empty links array, would be expected if there aren't any shared links created for files in that app folder. Is that the case? (The true has_more value is known issue though.)

If you just want to list the contents of the app folder, regardless of shared links, you can use the /files/list_folder endpoint:

https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder

Mark L.45
Collaborator | Level 8

No, the app folder had more than 1000 links within it created with the created_shared_link_with_settings API call, in subdirectories within the top directory named. So the app names a directory acme for example and within acme I have acmeA, acmeB and acmeC subdirectories; each of which contains X links to say photoA1, photoA2, photoA3 etc etc.

I make calls to https://api.dropboxapi.com/2/sharing/create_shared_link_with_settings for each photo I want to share? It all works if I make the app one that has access to all my folders? but when I use an app that names the folder at the top of the tree "acme" in this example, it lists nothing as you see?

Are you saying that if I name a specific folder with an app I don't need to actually share the links within it; they will be accessible with files-list_folder? I am missing something here aren't I?

Greg-DB
Dropbox Staff

That's correct, you don't need to share links to be able to access file listings and content via the API. You can use /files/list_folder to list the files in a folder, even if you haven't created links for them. And you can use /files/download to access the file content.

That said, you should receive shared links from /sharing/list_shared_links for the files in the app folder. It looks like you already have an API ticket open for this issue though. We requested a bit more information there though, so please reply there so we can continue looking into it for you. 

Mark L.45
Collaborator | Level 8

Gregory,

The other ticket was linked to a file shared that never appeared when I requested all links; that really does seem like a bug; but this, this is I am sure is me not using the API correctly? Let me try and run thru this again. I create a app, acme1066.

I create a directory ..

/Users/localuser/Dropbox/acme1066/Homework/math

I run the API command...

mymac:dropbox localuser$ curl -X POST https://api.dropboxapi.com/2/files/list_folder     --header "Authorization: Bearer ab-AUTHtoken"     --header "Content-Type: application/json"     --data "{\"path\": \"/Homework/math\",\"recursive\": false,\"include_media_info\": false,\"include_deleted\": false,\"include_has_explicit_shared_members\": false}"

But it returns ..

{"error_summary": "path/not_found/.", "error": {".tag": "path", "path": {".tag": "not_found"}}}

Note I created three files within Homework/math, what have I missed here?

 

Greg-DB
Dropbox Staff

Thanks for the additional information! Note that "app folders" for apps with the app folder permission are specially created folders inside the "/Apps" folder in your account. So, when you create your own folder at /acme1066/Homework/math, that won't connect to your app. The app's actual app folder would be at /Apps/acme1066/Homework/math.

Mark L.45
Collaborator | Level 8

Yes, now I understand. Just tried it and it worked perfectly; will modify my app, this is a far better solution than creating links!! I find 

mymac:acme1066 localuser$ pwd

/Users/localuser/Dropbox/Apps/acme1066

I created Monday, Tuesday, Wednesday etc within it and I list it with ..

curl -X POST https://api.dropboxapi.com/2/files/list_folder     --header "Authorization: Bearer <REDACTED>"     --header "Content-Type: application/json"     --data "{\"path\": \"\",\"recursive\": false,\"include_media_info\": false,\"include_deleted\": false,\"include_has_explicit_shared_members\": false}"

{"entries": [{".tag": "file", "name": "Monday", "path_lower": "/monday", "path_display": "/Monday", "id": "id:-jRneIVvgyAAAAAAAAAAAQ", "client_modified": "2016-06-21T05:12:51Z", "server_modified": "2016-06-21T05:12:56Z", "rev": "14a2437b4", "size": 0}, {".tag": "file", "name": "Tuesday", "path_lower": "/tuesday", "path_display": "/Tuesday", "id": "id:L1y7LIaRepAAAAAAAAAAAQ", "client_modified": "2016-06-21T05:12:56Z", "server_modified": "2016-06-21T05:13:02Z", "rev": "24a2437b4", "size": 0}, {".tag": "file", "name": "Friday", "path_lower": "/friday", "path_display": "/Friday", "id": "id:14SCeRsPtOAAAAAAAAAAAQ", "client_modified": "2016-06-21T05:13:11Z", "server_modified": "2016-06-21T05:13:16Z", "rev": "54a2437b4", "size": 0}, {".tag": "file", "name": "Wednesday", "path_lower": "/wednesday", "path_display": "/Wednesday", "id": "id:1VmOHG4gINAAAAAAAAAAAQ", "client_modified": "2016-06-21T05:13:00Z", "server_modified": "2016-06-21T05:13:06Z", "rev": "34a2437b4", "size": 0}, {".tag": "file", "name": "Thursday", "path_lower": "/thursday", "path_display": "/Thursday", "id": "id:_X1Hb6Ty6VAAAAAAAAAAAQ", "client_modified": "2016-06-21T05:13:06Z", "server_modified": "2016-06-21T05:13:12Z", "rev": "44a2437b4", "size": 0}], "cursor": "AAH6ZRqDays_h4zJR0z1EgLGtQzbKadBnTqOSd_O-sOp4I8gVBWLKvP4PInbvHxLhQrttjnS6NfHNVyP61piiIbf8Hvxi2K8QoW_T3ykuCjLwb9k6kuBpJ9_KpluePvypAY", "has_more": false}

And it works perfectly!!

 

Need more support?