fetch the contents of root folder

回答済み
新規投稿

コメント

8件のコメント

  • kendomen

    You can use postman and here's a nice blog by rory on it:

    https://blog.box.com/blog/using-postman-to-get-started-with-the-content-api-and-view-api-2/

     

    0
    コメントアクション Permalink
  • kendomen

    here's an example...

     

    postman.png

    0
    コメントアクション Permalink
  • RoryP

    Full set of collections an be retreived here! 

     

    https://docs.box.com/docs/box-postman-collection

     

    0
    コメントアクション Permalink
  • Sahil_Monga

    Thanks a lot Kendomen! It solved my problem.

     

    Could you also answer this query:

    1. I need to access this information using Javascript, so would I have to refer the two js files that were imported to Postman also before making a Get Request?

    0
    コメントアクション Permalink
  • kendomen

    i've been using the box-node-js sdk to make calls in javascript.  Will that work for you?

    0
    コメントアクション Permalink
  • Sahil_Monga

    Thanks Kendomen, it may work, can you share that.

    0
    コメントアクション Permalink
  • kendomen
    BoxSDK = require('box-node-sdk');
    
    fs = require('fs');
    path = require('path');
    
    var PRIVATE_KEY_PATH = '';
    
    var sdk = new BoxSDK({
        clientID: 'xxxxxx',
        clientSecret: 'xxxxx',
        appAuth: {
            keyID: 'xxxxx',
            privateKey: fs.readFileSync(path.resolve(PRIVATE_KEY_PATH)),
            passphrase: 'xxxxx'
        }
    });
    
    // Get the enterprise client, used to create and manage app user accounts
    var adminAPIClient = sdk.getAppAuthClient('enterprise', 'xxxxxx');
    
    adminAPIClient.users.get(adminAPIClient.CURRENT_USER_ID, null, function(err, currentUser) {
        if(err) throw err;
        console.log('Hello, ' + currentUser.name + '!');
    });
    
    // example:  filter user by name - aken2
    var requestParam = {
        qs: {
            filter_term: 'aken2'
        }
    };
    
    adminAPIClient.get('/users', requestParam,  adminAPIClient.defaultResponseHandler(function(err, data) {
    
        data.entries.forEach(function(user) {
           console.log(user.name);
    
           var userClient = sdk.getAppAuthClient('user', user.id);
           
           // get root folder items
            userClient.folders.getItems('0', null, function(err, data) {
               console.log(data);
            });
    
        });
    }));
    0
    コメントアクション Permalink
  • jiporter

    My box folders defaulted to my user directory. Can I safely move them to the root of my hard drive or must they live in the user directory to function?  Running OS X (latest version). tx

    0
    コメントアクション Permalink

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