var queryString ="SELECT+name+from+Account" var restUrl = "https://" + window.location.hostname + "/services/data/v38.0/query/?q=" + queryString + " -H " + "'Authorization: Bearer " + "{!$Api.Session_Id}'"; console.log(restUrl);