function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Surendra nuneSurendra nune 

How to fire a request to non salesforce endpoint from salesforce?

Hi,

I am trying to ire a request to non salesforce endpoint from salesforce using below code.
 
sforce.connection.remoteFunction({
             url : "url",
           requestHeaders: {"X-Auth-User":"xxxx", 
                               "X-Auth-Key":"xxx"
                              },
           method: "GET",
           onSuccess : function(response) {
                  console.log(response);
              },
           onFailure : function(response) {
                  alert("Failed" + response);
                  console.log(response);
              }
         });
But if i use the above code, I am getting this exception in browser console
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
<title>Error 401 Unauthorized</title>
</head>
<body><h2>HTTP ERROR 401</h2>
<p>Problem accessing /services/proxy. Reason:
<pre>    Unauthorized</pre></p><hr /><i><small>Powered by Jetty://</small></i><br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                
<br/>                                                

</body>
</html>

Please help me how to fix this.
 
sfdcwavesfdcwave
I have just been tasked to do the same thing - I have fire a POST to an endpoint that is using REST.   Have you had any luck?
Surendra nuneSurendra nune
No luck... :(