Cognos Analytics

 View Only
  • 1.  Sing a REST URL to logon to the IBM Cognos Analytics

    Posted Thu July 30, 2020 01:08 PM
    Reference URL: https://myibm.ibm.com/dashboard/

    Hi I was follownig this Q&A reguarding Mashup Using a REST URL to logon to the IBM Cognos Analytics Server: https://www.ibm.com/support/pages/mashup-using-rest-url-logon-ibm-cognos-analytics-server

    I understood the process but I am having some difficulties finding this information:

    CAMNamespace, myNameSpaceLabel, CAMUsername, User ID:, CAMPassword, Password, myPassWord

    Is there any kind of document, or instruction with more details about these items

    sincerely

    ------------------------------
    João Galdino
    ------------------------------

    #CognosAnalyticswithWatson


  • 2.  RE: Sing a REST URL to logon to the IBM Cognos Analytics

    Posted Thu July 30, 2020 03:44 PM

    Hi, João

    I wrote a code to do that:

    You have to create a HTML page that has input fields for namespace, user name and password.
    If you have only one namespace, you can hardcode it as I did (NameSpaceID). This information you may find in Content Manager Cognos Configuration.

    Then, save this HMTL page in cognos_gw_install/webcontent and set Cognos login page to this page on Cognos Administration new UI. (Manage > Configuration > System > Security)

             function doLogon()
             {
             
             	try {
             	  var objXHR = new XMLHttpRequest();
             	  } catch (e) {
             		try {
             		  var objXHR = new ActiveXObject('Msxml2.XMLHTTP');
             		} catch (e) {
             		  try {
             			var objXHR = new ActiveXObject('Microsoft.XMLHTTP');
             		  } catch (e) {
             			alert('XMLHttpRequest não suportado'); }
             		  }
             	  }
             
             	var nameSpace = 'NameSpaceId';
             	var userName = document.getElementById("sample.username").value;
             	var password = document.getElementById("sample.password").value;
    			var divError = document.getElementById("sampleIncorrectLoginText");
    
    			var baseUrl = window.location.protocol + "//" + window.location.host + "/" + window.location.pathname.split('/')[1];
             
             	var xmlData =
             	  "xmlData=<auth:credentials xmlns:auth='http://developer.cognos.com/schemas/ccs/auth/types/1'>"
             	  +"<auth:credentialElements><auth:name>CAMNamespace</auth:name>"
             	  +"<auth:value><auth:actualValue>"+nameSpace+"</auth:actualValue></auth:value></auth:credentialElements>"
             	  +"<auth:credentialElements><auth:name>CAMUsername</auth:name>"
             	  +"<auth:value><auth:actualValue>"+userName+"</auth:actualValue></auth:value></auth:credentialElements>"
             	  +"<auth:credentialElements><auth:name>CAMPassword</auth:name>"
             	  +"<auth:value><auth:actualValue>"+password+"</auth:actualValue></auth:value></auth:credentialElements>"
             	  +"</auth:credentials>";
             
    			document.getElementById('sample.login').disabled = true;
    		 
             	try
             	{
             		 objXHR.onreadystatechange = function() {
             							if (objXHR.readyState == 4) {
             								if (objXHR.status == 200) {
             									// Processes the response from the CMS Authentication service.
    											// If we recieve an "accountInfo" element back, we have successfully logged in.
             									var accountInfo = objXHR.responseXML.getElementsByTagName("auth:accountInfo");
             
    											if (accountInfo.length > 0)
    											{
    												window.location.replace(baseUrl);
    											}
    											else
    											{
    												divError.innerHTML = "Problemas ao efetuar o logon. Verifique as credenciais. \r\n" + objXHR.responseText;
    												document.getElementById('sample.login').disabled = false;
    											}
             									}
    										else
    										{
    												divError.innerHTML = "Problemas ao efetuar o logon. Verifique as credenciais. \r\n" + objXHR.responseText;
    												document.getElementById('sample.login').disabled = false;
    										}
             							}
             						}
             								
             								
             		objXHR.open("POST", baseUrl + "/bi/v1/disp/rds/auth/logon", false);
             		objXHR.setRequestHeader("Content-type","application/x-www-form-urlencoded");
             		objXHR.setRequestHeader("Content-length",xmlData.length);
             		objXHR.setRequestHeader("Connection","close");				
             		objXHR.send(xmlData);
             	}
             	catch (e)
             	{
    				divError.innerHTML = "Problemas ao efetuar o logon. \r\n" + e;
    				document.getElementById('sample.login').disabled = false;
             	}
    		}
    
    


    ------------------------------
    JEAM COELHO
    ------------------------------



  • 3.  RE: Sing a REST URL to logon to the IBM Cognos Analytics

    Posted Fri August 28, 2020 01:31 PM
    Hi João,

    Thanks for posting your code. That was very helpful!




    ------------------------------
    Cosme POUSSET
    ------------------------------



  • 4.  RE: Sing a REST URL to logon to the IBM Cognos Analytics

    Posted Fri August 28, 2020 02:09 PM
    Actually, I have posted. ��





  • 5.  RE: Sing a REST URL to logon to the IBM Cognos Analytics

    Posted Wed September 02, 2020 10:01 AM
    Thanks for Posting it ;-).
    I think João wants to log in at "https://myibm.ibm.com/dashboard/" or IBM Cognos Analytics Cloud. And I don't think so we can access the server and add any files.
    @João Please let me know if you need the same or something different.

    ------------------------------
    Mayank Sanghvi
    ------------------------------