Skip to main content
1 of 3

Salesforce REST Call with SessionID

I've got a Chrome extension running while I'm signed in to Salesforce. I want to use the SessionID from my session to query Opportunities. Here's my code so far:

function processSessionID(sessionID) {
    console.log(sessionID);
    // Make the REST call here
}


chrome.cookies.getAll({
  "domain": "lightning.force.com", "name": "JSESSIONID"
}, function(cookies) {
  for(i = 0; i < cookies.length; i++) {
    console.log(cookies[i].value);
    var sessionID = cookies[i].value;
    processSessionID(sessionID)
  }
});

How can I make a REST call with with the sessionID to return a list of opportunities?