Find your current IP for your Salesforce Instance

I am not sure how many of you faced this problem anyway I am explaining the issue and a solution for it.

I am in mid of development of consuming a third party API. And this API has the IP login restriction and in order to access the API we need to whitelist in their server.

So Salesforce recommends to whitelist list of IP ranges and but the IP ranges are too large and the IT team is very strict on whitelisting too much of IP.

Please go through the below link for IP ranges that need to be whitelisted as per Salesforce documentation based on the instances

https://help.salesforce.com/apex/HTViewSolution?id=000003652

So I found a website link http://icanhazip.com. Open the link and it will provide the current IP.

Also I found something like a GET request to this site provides the Salesforce IP.

In order to implement a HTTP request add the above mentioned site in the remote site settings

Now in your Developer Console -> Execute Anonymous Window

HttpRequest req = new HttpRequest();
req.setEndpoint('http://icanhazip.com/');
req.setMethod('GET');
Http httpReq = new Http();
HttpResponse res = httpReq.send(req);
System.debug(res.getBody());

Check your debug log and this provide the current IP address which your current instance in pinging in.

Hope this information is helpful

Comments

Popular Posts