General Technical Discussions for Service

Get Involved. Join the Conversation.

Topic

    Ranjith Kumar M
    How to get SessionId from Oracle Agent Desktop web UI?Answered
    Topic posted August 3, 2017 by Ranjith Kumar MRed Ribbon: 250+ Points 
    140 Views, 2 Comments
    Title:
    How to get SessionId from Oracle Agent Desktop web UI?
    Content:

    how to get session id from oracle agent desktop web UI using javascript

    Version:
    Service Cloud Agent Desktop browser UI

    Best Comment

    Bastiaan van der Kooij

    That is all just nicely documented in the Developer Guide for BUI

     

    Comment

     

    • Bastiaan van der Kooij

      That is all just nicely documented in the Developer Guide for BUI

       

    • Edson Junior

      Here goes an exemple:


                      ORACLE_SERVICE_CLOUD.extension_loader.load('Incindet_Lookup_Extension','1')
                      .then(function(extensionProvider)
                          {
                          extensionProvider.getGlobalContext().then(function(globalContext)
                              {
                                  _urlrest = globalContext.getInterfaceServiceUrl("REST");

                                  globalContext.getSessionToken().then(
                                     function(sessionToken){
                                      sessionID = sessionToken;
                                      console.log("URL: " + _urlrest);                                
                                      console.log("Session: " + sessionID);

                                      MyInboxReportAPI(_urlrest, sessionID);

                                     });
                              }
                          );
                          }
                      );                

                      
                  }

                  function MyInboxReportAPI(restUrl, sessionID)
                  {
                      var xhr = new XMLHttpRequest();
                      var param = '{"id": 100752}';    
                      
                      xhr.open("post", restUrl + "/connect/v1.3/analyticsReportResults");
                      xhr.setRequestHeader("Authorization", "Session " + sessionID);
                      xhr.onload = function() {
                          var obj = JSON.parse(xhr.responseText);                                        
                          MyInboxPanel(obj);
                      }
                      xhr.send(param);
                  }