You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
mikechiu
8 months agoExplorer | Level 4
Response of the list shared link API for team folders
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!
- Greg-DBDropbox 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.
- Здравко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.
- mikechiuExplorer | 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.
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,888 PostsLatest Activity: 5 hours agoIf 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 or Facebook.
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!