AnsweredAssumed Answered

Connect Rally Web Services API in Jquery without Node.js

Question asked by Qijiang60 on Jan 24, 2017
Latest reply on Feb 16, 2017 by davse04

I am try to access Rally api by using ajax Jquery. So how I don't figure out how to add proxy server info, personal login and token in .ajax. Currently I got error 401 error, as there is proxy server in betweens. my code as below.

adminUn = rallyuser;adminPw = rallytoken;var tok = adminUn + ':' + adminPw;var hash = Base64.encode(tok);var authCredentials = "Basic " + hash;function jQueryGetMethod (url, data) { $.ajax({   url: url,   type: 'GET', // The HTTP Method   mimeType: 'application/javascript',   datatype: 'json',   error: function(err) { alert(err); },   complete: function(xhr) {     if (xhr.status === 200) {       repositories = xhr.responseJSON;       outputPageContent(); } else {     alert('Request failed.  Returned status of ' + xhr.status); }   },   error: function( req, status, err ) { console.log( 'something went wrong', status, err ); },   beforeSend: function(xhr, settings) { xhr.setRequestHeader('Authorization',authCredentials);       xhr.setRequestHeader('Content-Type', 'text/plain');} });

Outcomes