Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {[
- { "nnnnnnnnnn<html>nn<head>n <title>Unauthorized (401)</title>n },
- { "nnnnnnnnnn<html>nn<head>n <title>Unauthorized (401)</title>n },
- { "nnnnnnnnnn<html>nn<head>n <title>Unauthorized (401)</title>n },
- { "errors":[],"detail":[{"repositories":[],"_instance":{"applicationLinkId":"4b0d5edc-c683-3502-aed7-5f6e152b877d" },
- {"errors":[],"detail":[{"repositories":[],"_instance":{"applicationLinkId":"4b0d5edc-c683-3502-aed7-5f6e152b877d"}
- ]}
- exports.getCommits = function(req, res) {
- console.log(filename + '>>get commits>>');
- var response = {
- status : Boolean,
- message : String,
- data : String
- };
- var request = require('request');
- var username = username ;
- var password = password ;
- var options = {
- url : 'https://computenext.atlassian.net/rest/api/2/search?jql=status+%3D+Resolved+ORDER+BY+updated&maxResults=100',
- auth : {
- username : username,
- password : password
- }
- };
- request( options, function(error, obj) {
- if (error) {
- response.message = appmsg.DATA_NT_FOUND;
- response.status = false;
- response.data = obj;
- res.send(response);
- } else {
- response.message = appmsg.DATA_FOUND;
- response.status = true;
- response.data = JSON.parse(obj.body);
- var respon = {
- status : Boolean,
- message : String,
- data : String
- };
- var issueKey = response.data.issues;
- var id = issueKey[0].id;
- var commitout = [];
- var lookup_list = [];
- for(var i = 0; i < issueKey.length; i++) {
- var commits = issueKey[i].id;
- url = "https://computenext.atlassian.net/rest/dev-status/1.0/issue/detail?issueId=" + commits + "&applicationType=stash&dataType=repository";
- auth = "Basic " + new Buffer(username + ":" + password ).toString("base64");
- request({url : url, headers : {"Authorization" : auth}}, function(err, obj1){
- if (obj1) {
- commitout.push(obj1.body);
- if(issueKey.length === commitout.length){
- respon.message = appmsg.DATA_FOUND;
- respon.status = true;
- respon.data = commitout;
- res.send(respon);
- }
- }
- });
- }
- }
- });
Add Comment
Please, Sign In to add comment