Advertisement
Guest User

Untitled

a guest
Mar 18th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. require('dotenv').config();
  2. const kintone = require('kintone-nodejs-sdk');
  3. const env = process.env;
  4.  
  5. // Define Authentication object
  6. let kintoneAuth = new kintone.Auth();
  7. let username = env.USER_NAME;
  8. let password = env.PASSWORD;
  9. kintoneAuth.setPasswordAuth(username, password);
  10.  
  11. let DomainName = env.DOMAIN;
  12. let kintoneConnection = new kintone.Connection(DomainName, kintoneAuth);
  13. let kintoneApp = new kintone.App(kintoneConnection);
  14.  
  15. function fetchApps(optOffset, optLimit) {
  16. let offset = optOffset || 0;
  17. let limit = optLimit || 100;
  18.  
  19. kintoneApp.getApps(offset, limit)
  20. .then((rsp) => {
  21. let apps = rsp.apps;
  22. if (apps.length === 100) {
  23. console.log(apps);
  24. return fetchApps(offset + 100, limit);
  25. }
  26. console.log(apps);
  27. })
  28. .catch((err) => {
  29. // This SDK return err with KintoneAPIExeption
  30. console.log(err.get());
  31. });
  32.  
  33. }
  34.  
  35. fetchApps();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement