Level up your Box knowledge with brand new learning paths on Box University. Visit training.box.com to get started

Searching for owner of folder through API

New post

Comments

3 comments

  • Rui Barbosa

    Hi Keven,

    I was trying to replicate your issue but I need some more info.

    When you mentioned "this is the same user that I am authorizing the app through box" I think of an OAuth 2 app with user or client authentication.

    Although it is possible to make API calls using the as-user header:

    The authenticated user must have admin permissions, see here.

    Are you trying to find a folder owned by another user, not the authenticated one? The sharing permissions are still enforced.

    The as-user is more common in a JWT application, which has its own service user and then can "impersonate" another user, take a look here.

    Let us know if this helps.

     

     

    0
    Comment actions Permalink
  • Keven Scharaswak

    thank you for the response. I have a couple apps that all are atempting to do the same thing.

    I have an app that uses JWT, but got 0 search results on anything but the root

    I have an app that uses Oauth2 with Client Grant

    and this app that uses user auth. I have the check box checked for using the as-user header. and the user that I am passing in is an admin. 

    to your question "Are you trying to find a folder owned by another user, not the authenticated one?" that is correct. I am using an admin account to find a folder and retrieve the current owner of it. 

    "The sharing permissions are still enforced." does this mean that I have to have the folder shared to me in order to see it in a query? if so, how can I accomplish the following:

    I would like to search for a folder by name, using an admin account, and retrieve its current owner.

    I can do this through the website using the admin credentials. I would like to do it programmatically. 

    0
    Comment actions Permalink
  • Alex Novotny

    Hi Keven! 

    To find a folder by name, you need to use our Search API. You also would need to run the command with an as-user header if you are looking for content that is not owned or not collaborated with the user you are using to run the command. The admin doesn't have blanket access to search all content in an organization unless that are collaborated in or own all content. 

    There's not a way to find out who owns a folder programmatically if you don't have access to the content. 

    By "I can do this through the website..." what do you mean exactly? 

    Thanks, 

    Alex, Box Developer Advocate

    0
    Comment actions Permalink

Post is closed for comments.