Guest User

Untitled

a guest
Mar 24th, 2017
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. function getPointp(apiKey) {
  2. var url = 'https://api.torn.com/market/?selections=pointsmarket&key='+ apiKey;
  3. var options = {
  4. 'method' : 'post',
  5. 'contentType': 'application/json',
  6. 'muteHttpExceptions': true
  7. };
  8. var res = UrlFetchApp.fetch(url, options);
  9. var resText = res.getContentText();
  10. var respOBJ = JSON.parse(resText).pointsmarket;
  11. var IDs = Object.keys(respOBJ);
  12. var values = [];
  13.  
  14. for(i = 0; i < 1; i++) {
  15. values.push(respOBJ[IDs[i]].cost);
  16. }
  17. if (values.length > 0) {
  18. return Math.min.apply(null, values);
  19. }
  20. };
Advertisement
Add Comment
Please, Sign In to add comment