为仪表板项目处理 WSO2 UES 应用程序,在此,需要使用带有 HEADER 数据的 GET 方法调用 REST api 。( var headers ={"授权",getSecureToken}; )
http://jaggeryjs.org/documentation.jag?api=get没有提供足够的信息
<%
var getSecureToken = session.get("wso2-token");
var headers ={"Authorization",getSecureToken};
var userListUrl = "https://00.000.00.00:09000/users/1.0.0/users/list";
var userListData = get(userListUrl,headers,"json");
log.info(userListData);
%>
任何帮助将不胜感激。:-)
更新: GET方法功能:
function FnMakeRequestGETCall(URL, METHOD, BASICAUTH, CONTENTTYPE, ACCEPTTYPE, INPUTDATA){
var VarBasicAuthCode = session.get('wso2-token');
xhr = new XMLHttpRequest();
xhr.open(METHOD, URL);
xhr.setRequestHeader("Authorization" , VarBasicAuthCode);
xhr.setRequestHeader("Content-Type", CONTENTTYPE);
xhr.setRequestHeader("Accept", ACCEPTTYPE);
xhr.send();
var VarResponse = xhr.responseText;
return VarResponse;
}
var userListUrl = "https://99.999.99.999:9445/users/1.0.0/users/list";
var headers ={"Authorization",getSecureToken};
var usersList = FnMakeRequestGETCall(userListUrl,"GET","Basic RlN4S2RrZEpNN3VaYWhHN0NFcEtlaTZEa3RzYTpXbmUxd29seHp2UTNSQ2RZbXhUUTJ2WkJTd0Fh","application/x-www-form-urlencoded; charset=UTF-8","application/json; charset=utf-8","");
log.info(usersList);