Enterprise wide search of box contents

新規投稿

コメント

3件のコメント

  • arvind6353

    Hi Team , 

     

    Am following the below steps :

    • Used the service account to create a new app user .
    • Got the user ID in the response
    • Created an app user client using the ID from the above step
    • Made the search api call using box-node-sdk . (

    client.search.query(

            'Test',

             {

              file_extensions: 'doc,docx,pptx',

              limit: 200,

              scope:'enterprise_content',

              offset: 0,

            },

            function(err, res){

              if(err){

                console.log("error ",err);

                return;

              }

              console.log(res);

        

            }

          );

     

     

           5) When I set the scope as user_content getting zero results but no error . ( using app user client)

           6) When I set the scope as enterprise_content ( which is the requirement ) Getting the following error:

          { type: 'error',

            status: 403,

            code: 'access_denied_insufficient_permissions',

            help_url: 'http://developers.box.com/docs/#errors',

            message: 'Access denied - insufficient permission',

            request_id: 'flmcm6fo6ujhtwkk' } } }

     

      Should I search using the service account client or app user client ? . In the docs it is mentioned that we need to make a call using app user client created by service account.

     

      If I do a search using service account client , it is returning response as { total_count: 313631, entries: [], limit: 20, offset: 0 } . Here entries field is coming as empty.

     

     Kindly help in resolving this and also let us know if any other info is required.

     

    0
    コメントアクション パーマリンク
  • Murtza

      

    When you make a call to the Search endpoint, it returns results based on what content the user who you are making the call on behalf of has access to.

     

    For example, let's say user A owns files 1,2,3, user B owns files 4,5,6, and there no collaborations on any of these files between these users. When you make a call to the Search endpoint as user B, you won't see files 1,2,3 in those search results. 

     

    Returning to your use case, you have two options: 

    • You can make the calls using the Service Account, an enterprise access token, and the As-User header. For the As-User header, you would specify the Managed User that you want to make calls on behalf of. 
    • If you want to use an App User for this use case, the second option would be to collaborate the App User on the content you want to search. Then you can use the App User access token to make calls to the Search endpoint.
    0
    コメントアクション パーマリンク
  • arvindan

    Hi 

    Thanks for the information.

    Since I want to get all the enterprise wide contents.
    I guess i will use the service account with enterprise token and as user
    header
    . Can you tell me how to create a managed user.

    When I use box-node-sdk and created the service account client and do a
    search.

    It is returning me the result with total as 12545 (example). But the
    entries array is empty.
    Not sure why the entries array is coming as empty but the total has some
    value.



    Thanks,
    Arvindan.

    0
    コメントアクション パーマリンク

サインインしてコメントを残してください。