Guest User

Untitled

a guest
Nov 21st, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.63 KB | None | 0 0
  1. {[
  2. { "nnnnnnnnnn<html>nn<head>n <title>Unauthorized (401)</title>n },
  3. { "nnnnnnnnnn<html>nn<head>n <title>Unauthorized (401)</title>n },
  4. { "nnnnnnnnnn<html>nn<head>n <title>Unauthorized (401)</title>n },
  5. { "errors":[],"detail":[{"repositories":[],"_instance":{"applicationLinkId":"4b0d5edc-c683-3502-aed7-5f6e152b877d" },
  6. {"errors":[],"detail":[{"repositories":[],"_instance":{"applicationLinkId":"4b0d5edc-c683-3502-aed7-5f6e152b877d"}
  7. ]}
  8.  
  9. exports.getCommits = function(req, res) {
  10. console.log(filename + '>>get commits>>');
  11. var response = {
  12. status : Boolean,
  13. message : String,
  14. data : String
  15. };
  16. var request = require('request');
  17. var username = username ;
  18. var password = password ;
  19. var options = {
  20. url : 'https://computenext.atlassian.net/rest/api/2/search?jql=status+%3D+Resolved+ORDER+BY+updated&maxResults=100',
  21. auth : {
  22. username : username,
  23. password : password
  24. }
  25. };
  26. request( options, function(error, obj) {
  27. if (error) {
  28. response.message = appmsg.DATA_NT_FOUND;
  29. response.status = false;
  30. response.data = obj;
  31. res.send(response);
  32. } else {
  33. response.message = appmsg.DATA_FOUND;
  34. response.status = true;
  35. response.data = JSON.parse(obj.body);
  36. var respon = {
  37. status : Boolean,
  38. message : String,
  39. data : String
  40. };
  41. var issueKey = response.data.issues;
  42. var id = issueKey[0].id;
  43. var commitout = [];
  44. var lookup_list = [];
  45. for(var i = 0; i < issueKey.length; i++) {
  46. var commits = issueKey[i].id;
  47. url = "https://computenext.atlassian.net/rest/dev-status/1.0/issue/detail?issueId=" + commits + "&applicationType=stash&dataType=repository";
  48. auth = "Basic " + new Buffer(username + ":" + password ).toString("base64");
  49. request({url : url, headers : {"Authorization" : auth}}, function(err, obj1){
  50. if (obj1) {
  51. commitout.push(obj1.body);
  52. if(issueKey.length === commitout.length){
  53. respon.message = appmsg.DATA_FOUND;
  54. respon.status = true;
  55. respon.data = commitout;
  56. res.send(respon);
  57. }
  58. }
  59. });
  60. }
  61. }
  62. });
Add Comment
Please, Sign In to add comment