It's all about the answers!

Ask a question

How to programmatically retrieve details from RTC using AJAX REST api with Authentication


S S (141418) | asked Mar 20 '14, 11:38 a.m.
edited Mar 20 '14, 11:39 a.m.
If I point my browser to a url, it successfully displays the request REST info for an RTC work item.

I'd like to get the same info using an ajax call from a webpage on another server. However, when trying access I get errors.
The first step is to create a proxy on the webserver so it gets around the ajax x-domain limitation. I then have a webpage on this same webserver that makes an ajax call to another URL using the get URL function below.

However, it fails trying to display the jazz username/password screen and just continuously display s a "Loading..." message.

I've tried to include the username/password as part of the jax call, but that doesn't seem to bypass the Jazz authentication either.
	
function get_url( urlx ) {
 
		var username = "user123";
		var password = "password123";
 
		var txt = "";

    	$.ajax({
      		url: urlx,
      		type: "GET",
      		dataType: "text",
	  		async: false,
 
    		beforeSend: function (xhr){ 
        		xhr.setRequestHeader('Authorization', make_base_auth(username, password)); 
    		},
      		
			success: function(data){
				txt = data;
	 		},	
      		error: function(msg){
        
      		}    
    	});
 
		return txt; 
	
} 

Be the first one to answer this question!


Register or to post your answer.


Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.