How to clear the session ID of another platform in google data studio community Connector

Viewed 89

I created a community connector for Google Data Studio to get access for another platform. And I want to clear the session ID after getting the data from that platform. What should I do? Here is my code


function fetchFromNodeRestApi(){

  var sessionID = [  
     
    'http://test.smartapps.lk/rest/api/login?loginName=+loginName+&password=+password+'
  ].join(''); 
  
  var responseID = UrlFetchApp.fetch(sessionID);
  var document = XmlService.parse(responseID.getContentText()); 
  var correctSessionId = document.getRootElement().getChild('sessionId').getValue(); 

  var url=[
    'http://test.smartapps.lk/rest/api/selectQuery?sessionId=' + correctSessionId + '&maxRows=5&query=select Item_Name, Date , Weight from Customer_Order_demand &output=json'
  ].join('');
  
  var responseID2 = UrlFetchApp.fetch(url); 

  var jsonObj = JSON.parse(responseID2.getContentText());  
  
  var finalArray = [];
  
  for(var i in jsonObj){

    var newObj = {
      
      "Item_Name": jsonObj[i][0],
      "Date": jsonObj[i][1],
      "Weight": jsonObj[i][2] 
      
    };
    
    finalArray.push(newObj);
  }   
 return finalArray;     
}
0 Answers
Related