fetch the contents of root folder
回答済みHi Folks,
I am very new to Box.com and APIs, need your help here:
I tried to fetch the contents of root folder for my Box account by pasting the below url in browser and I am unable to get the results as there is just a blank page. could some one please help me out here:
https://api.box.com/2.0/folders/0 \-H "Authorization: Bearer myDeveloperToken"
Do I need to consume this URL in an application like C# console or HTML application to make it work.
Thanks in advance!
-
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/
-
Full set of collections an be retreived here!
https://docs.box.com/docs/box-postman-collection
-
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); }); }); }));
サインインしてコメントを残してください。
コメント
8件のコメント