Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

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

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; 
	
} 

0 votes


Be the first one to answer this question!

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 12,022

Question asked: Mar 20 '14, 11:38 a.m.

Question was seen: 3,618 times

Last updated: Mar 20 '14, 11:39 a.m.

Confirmation Cancel Confirm