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's avatar
mikechiu
Explorer | Level 4
2 years ago

Shared links inheritance behavior in Team Space model

Hi, I am working on getting the shared links of a file or a folder along with it's  parent's shared links with API list_shared_links.

 

However, I got different response from Team Space and Team Folders model.

 

For Team Space model, neither given true nor false to `direct_only`, there's no parent's shared links in the response.

 

For Team Folders model, direct_only works as the description. 

 

Just want to make sure is this expected behavior ? Cause there's no description about it.

Thanks! 

  • Здравко's avatar
    Здравко
    Legendary | Level 20

    mikechiu wrote:

    ...

    However, I got different response from Team Space and Team Folders model.

    ...


    Hi mikechiu,

    While you work on different accounts (either with different or the same configuration) it's normal to have different responses. Different accounts may have different content (alongside the configuration) including available links set and how the links, pointing to corresponding files/folders, are distributed throughout their account.

     


    mikechiu wrote:

    ...

    For Team Space model, neither given true nor false to `direct_only`, there's no parent's shared links in the response.

    ...


    Why do you think there should be more links? 🤔 Are there available such links? Is it certain?

    In general the behavior should be the same.

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Staff rankDropbox Staff

    mikechiu If you want /2/sharing/list_shared_links to return parent links you should set "direct_only" to false, or omit it entirely. That should return parent links, even in a team space, but as Здравко noted, that will only occur if there are parent links to return.

     

    From your description, it sounds like there weren't any parent shared links to return in the team space case you tried. I just tried it out myself and I was able to retrieve an existing parent shared link in a team space when using "direct_only":false (and when omitting "direct_only").

  • mikechiu's avatar
    mikechiu
    Explorer | Level 4

    Thanks Здравко and Greg-DB for replying this.

    However, I still can't get the parent's shared link back.

     

    Here is the detailed steps:

    1) Create a private folder Team_shared_links_inheritance under UserA's team member folder

    2) Create view link for the private folder with access Anyone with the links

    3) Upload a file under the folder Team_shared_links_inheritance

    4) Make an API Call to list_shared_links to list folder Team_shared_links_inheritance's shared links with Team Admin Bearer Token and set team_member_id of UserA for Dropbox-API-Select-User  header.

     

    And successfully get the shared link back in response.

     

    5) Make an API Call to list_shared_links to list the file's shared link without direct_only, but there's nothing back in the response. (with the same headers, changing the path to the file's id in payload)

     

    So I just wondering if the inherited shared links is available under specific circumstances like must set the path instead of id or the `Dropbox-API-Select-User` header is not enough ?

     

    Thanks. 

    • Здравко's avatar
      Здравко
      Legendary | Level 20

      HI mikechiu,

      I just checked, to be sure, and it's working with either path or id. So no issue at all. In your description is not clear where you got the file id in use. Does it belong certainly to the file you uploaded (or any other file in your Team_shared_links_inheritance folder)? 🤔 If not, this is the issue. If no some explanation still, share your program code that leads to this issue (not only verbal description), since something is missing in your description. Mask your access/refresh token etc. but show all API calls as full as possible so the issue could be reproduced.

    • Greg-DB's avatar
      Greg-DB
      Icon for Dropbox Staff rankDropbox Staff

      mikechiu If you can share a sample like Здравко described, that would be helpful. Thanks!

      • mikechiu's avatar
        mikechiu
        Explorer | Level 4

        Hi @Greg-DB and @Здравко , thanks for your reply. 

         

        Why do you think there should be more links? 🤔 Are there available such links? Is it certain?

         Yes, I think when I list child file's shared links, there should be parent's shared links in the response.

         

        I test upstream API via Postman and Curl. 

        Below are my detailed steps:

        1. Get team admin access token

        2. List all namespaces 

         

         

        3. List mike chiu 's team_member_folder with namespace: ns:4710493057

        mike chiu's team_member_id: dbmid:AABoDSTDeZtrGKUDsWr8OP_qv9l6s8itCCk

         

         

        4. List folderTest_shared_links_inheritance(id:sK5VCkFxNtoAAAAAAAAAZA)

         

        There is a file named EWAU.png (id:sK5VCkFxNtoAAAAAAAAAZQ) under this folder


        5. List shared links of folder Test_shared_links_inheritance with header Dropbox-API-Select-User: dbmid:AABoDSTDeZtrGKUDsWr8OP_qv9l6s8itCCk

        ❯ curl -s -XPOST -H "Authorization: Bearer $dt" -H "Content-Type: application/json" -H "Dropbox-API-Select-User: dbmid:AABoDSTDeZtrGKUDsWr8OP_qv9l6s8itCCk" -d '{"path": "id:sK5VCkFxNtoAAAAAAAAAZA"}' https://api.dropboxapi.com/2/sharing/list_shared_links  | jq .
        {
          "links": [
            {
              ".tag": "folder",
              "url": "https://www.dropbox.com/scl/fo/(redated)...",
              "id": "id:sK5VCkFxNtoAAAAAAAAAZA",
              "name": "Test_shared_links_inheritance",
              "path_lower": "/test_shared_links_inheritance",
              "link_permissions": {
                "resolved_visibility": {
                  ".tag": "public"
                },
                "requested_visibility": {
                  ".tag": "public"
                },
                "can_revoke": true,
                "effective_audience": {
                  ".tag": "public"
                },
                "link_access_level": {
                  ".tag": "viewer"
                },
                "visibility_policies": [
                  {
                    "policy": {
                      ".tag": "public"
                    },
                    "resolved_policy": {
                      ".tag": "public"
                    },
                    "allowed": true
                  },
                  {
                    "policy": {
                      ".tag": "team_only"
                    },
                    "resolved_policy": {
                      ".tag": "team_only"
                    },
                    "allowed": true
                  },
                  {
                    "policy": {
                      ".tag": "password"
                    },
                    "resolved_policy": {
                      ".tag": "password"
                    },
                    "allowed": true
                  }
                ],
                "can_set_expiry": true,
                "can_remove_expiry": true,
                "allow_download": true,
                "can_allow_download": true,
                "can_disallow_download": true,
                "allow_comments": false,
                "team_restricts_comments": false,
                "audience_options": [
                  {
                    "audience": {
                      ".tag": "public"
                    },
                    "allowed": true
                  },
                  {
                    "audience": {
                      ".tag": "team"
                    },
                    "allowed": true
                  },
                  {
                    "audience": {
                      ".tag": "no_one"
                    },
                    "allowed": true
                  }
                ],
                "can_set_password": true,
                "can_remove_password": true,
                "require_password": false,
                "can_use_extended_sharing_controls": true
              },
              "team_member_info": {
                "team_info": {
                  "id": "(redated)",
                  "name": "(redated)"
                },
                "display_name": "Mike Chiu",
                "member_id": "dbmid:AABoDSTDeZtrGKUDsWr8OP_qv9l6s8itCCk"
              }
            }
          ],
          "has_more": false
        }

         

        6. listEWAU.png (id:sK5VCkFxNtoAAAAAAAAAZQ)'s shared link with same header (Dropbox-API-Select-User)

        ❯ curl -s -XPOST -H "Authorization: Bearer $dt" -H "Content-Type: application/json" -H "Dropbox-API-Select-User: dbmid:AABoDSTDeZtrGKUDsWr8OP_qv9l6s8itCCk" -d '{"path": "id:sK5VCkFxNtoAAAAAAAAAZQ"}' https://api.dropboxapi.com/2/sharing/list_shared_links | jq .
        {
          "links": [],
          "has_more": false
        }
        ❯ curl -s -XPOST -H "Authorization: Bearer $dt" -H "Content-Type: application/json" -H "Dropbox-API-Select-User: dbmid:AABoDSTDeZtrGKUDsWr8OP_qv9l6s8itCCk" -d '{"path": "id:sK5VCkFxNtoAAAAAAAAAZQ", "direct_only": false}' https://api.dropboxapi.com/2/sharing/list_shared_links | jq .
        {
          "links": [],
          "has_more": false
        }

         

        Hopefully those steps are detailed enough and please let me know if anything I can provide to you.

        Thanks.

  • mikechiu's avatar
    mikechiu
    Explorer | Level 4

    I don't know why post twice. I will keep the latest one and delete this one.