cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Announcements
What’s new: end-to-end encryption, Replay and Dash updates. Find out more about these updates, new features and more 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: 

Response of the list shared link API for team folders

Response of the list shared link API for team folders

mikechiu
Explorer | Level 4

Hi, I observed a different response from list shared link API for those sub folders under a team folder.

 

There is a folder test0327 under a Team Folder, the path is /Team Folder For Integration Test/test0327

Its metadata is: 

{

    ".tag": "folder",

    "name": "test0327",

    "parent_shared_folder_id": "2375939763",

    "id": "id:0b3RzxZNBvUAAAAAAAAAeg",

    "shared_folder_id": "2417396531",

    "sharing_info": {

        "read_only": false,

        "parent_shared_folder_id": "2375939763",

        "shared_folder_id": "2417396531",

        "traverse_only": false,

        "no_access": false

    }

}

 

And I've edit this folder's access through Admin Console to make this folder only be accessed with userA and userB.

Now I use a team Admin's team_member_id as Select-User to make requests to list shared links API with/without Dropbox-API-Path-Root and use id/shared_folder_id respectively.

Below are the results:

 

❯ curl -s -XPOST -H "Authorization: Bearer $dt" -H "Content-Type: application/json" -H "Dropbox-API-Select-User: $AdminTeamMember_id" -d '{"path": "id:0b3RzxZNBvUAAAAAAAAAeg", "direct_only": true}' https://api.dropboxapi.com/2/sharing/list_shared_links  | jq .

{

  "error_summary": "permission_denied/.",

  "error": {

    ".tag": "permission_denied"

  }

}

 

❯ curl -s -XPOST -H "Authorization: Bearer $dt" -H "Content-Type: application/json" -H "Dropbox-API-Select-User: $AdminTeamMember_id" -H "Dropbox-API-Path-Root: {\".tag\": \"root\", \"root\": \"2103744179\"}" -d '{"path": "id:0b3RzxZNBvUAAAAAAAAAeg", "direct_only": true}' https://api.dropboxapi.com/2/sharing/list_shared_links  | jq .

{

  "error_summary": "permission_denied/",

  "error": {

    ".tag": "permission_denied"

  }

}

 

❯ curl -s -XPOST -H "Authorization: Bearer $dt" -H "Content-Type: application/json" -H "Dropbox-API-Select-User: $AdminTeamMember_id" -d '{"path": "ns:2417396531", "direct_only": true}' https://api.dropboxapi.com/2/sharing/list_shared_links  | jq .

{

  "error_summary": "path/not_found/..",

  "error": {

    ".tag": "path",

    "path": {

      ".tag": "not_found"

    }

  }

 

❯ curl -s -XPOST -H "Authorization: Bearer $dt" -H "Content-Type: application/json" -H "Dropbox-API-Select-User: $AdminTeamMember_id" -H "Dropbox-API-Path-Root: {\".tag\": \"root\", \"root\": \"2103744179\"}" -d '{"path": "ns:2417396531", "direct_only": true}' https://api.dropboxapi.com/2/sharing/list_shared_links  | jq .

{

  "links": [],

  "has_more": false

}

 

As you can see, when using id:0b3RzxZNBvUAAAAAAAAAeg as path, I got the permission denied response with or without Path-Root header, which might be expected I think, however, when using ns:2417396531, I got two different responses with/without Path-Root header.

 

So I was wondering:

1) Which response is expected actually ? 

2) Do I need to use Path-Root header or not since the API document does not mention this ?

3) Should I use shared_folder_id or id as path parameter?

4) Is there any way to list shared links with WholeTeamAdmin header?

 

Above response and behavior is really confusing, please can anyone help clarify or fix that ? Thanks!

 

 

5 Replies 5

Здравко
Legendary | Level 20

@mikechiu wrote:

..., I got two different responses with/without Path-Root header.

...


Hi @mikechiu,

It's normal, since by default (when nothing set) your Path-Root is your home folder. Let's recall your test folder is outside your home folder. So, without Path-Root set to your team space, the target folder is "invisible" and that's why "path/not_found". Opposite, when set, it's visible, but there is no any link set (make difference between shared folder and shared link) and that's why non erroneous empty result. 😉

Hope this clarifies the things to some extent.

mikechiu
Explorer | Level 4

Hi @Здравко thanks for your reply for the Path-Root, makes sense to me.

 

But how can I understand the permission error when using id instead of shared folder id in both cases without Path-Root? 

Cause for me these two are the same. And actually, there's a shared link existed if I use UserA as Select-User. 

Thus for me, more reasonable result is not empty but permission denied since empty result will make false judgement.

 

Здравко
Legendary | Level 20

@mikechiu, I'm not some Dropbox system designer and that's why can only speculate on this. I agree that it's somehow confusing since not systematically documented (not yet at least). I just took a look on other posts from you and saw that you have created (or was trying to create) shared link on places where links are restricted. If the case here is something similar and I have to bet - you're trying to get link that's not supposed to be there at all and you get such error. In general using path, id, or namespace (wherever available, i.e. shared folder) should be the same. Probably some API imperfection. Let's hope will be fixed and/or documented properly.

Good luck.

 

Ops, just a moment: Do you mean that you have used a user that doesn't have access to there (doesn't matter it's admin - at that moment there is no admin, but just user)? If so, then the things are clear - just missing permission as stated by the error.

mikechiu
Explorer | Level 4

Hi @Здравко , thanks for your quick reply!

Yes, the user that I used for Select-User is unable to access the target file/folder.

So that's why I am confused why not all upstream responses are the same.

 

And I totally agree with you regarding the imperfection of the API. 

So here is what I am going to do, just use the response that I confirmed through the test and hopefully it won't change sometime. 

 

Really appreciate your help. Thanks!

Greg-DB
Dropbox Staff

@mikechiu I see Здравко already helped out with this, but to confirm a few things:

 

By default, when not using the "Dropbox-API-Path-Root" header, the root will default to the home folder. Any time you want to use a different root, you will need to set that header. Refer to the Team Files Guide for more information.

 

The /2/sharing/list_shared_links endpoint does not support 'Dropbox-API-Select-Admin', so it's not possible to use the "Whole Team" mode with that endpoint.

Need more support?
Who's talking

Top contributors to this post

  • User avatar
    Greg-DB Dropbox Staff
  • User avatar
    mikechiu Explorer | Level 4
  • User avatar
    Здравко Legendary | Level 20
What do Dropbox user levels mean?