Created
March 17, 2015 14:47
-
-
Save pingyen/5ee761745292827a9a29 to your computer and use it in GitHub Desktop.
Getting Box File Details
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var folderID = '1234567890', | |
| pageNum = 100; | |
| var jsons = [], | |
| files = []; | |
| for (var i = 0; i < pageNum; ++i) { | |
| jsons.push($.getJSON('https://app.box.com/index.php?rm=box_item_list&q[sort]=name&q[direction]=DESC&q[id]=d_' + folderID + '&q[page_num]=' + i + '&q[page_size]=20&q[theme_id]=1&q[collection_id]=0')); | |
| } | |
| $.when.apply($, jsons).done(function() { | |
| var n = arguments.length; | |
| for (var i = 0; i < n; ++i) { | |
| var nodes = arguments[i][0].nodes, | |
| m = nodes.length; | |
| for (var j = 0; j < m; ++j) { | |
| var node = nodes[j]; | |
| files.push(node.name); | |
| } | |
| } | |
| console.log(files.length); | |
| document.write(JSON.stringify(files)); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment