+ Start a Discussion
Senthil Kumar 103Senthil Kumar 103 

How to access my external webapp using REST API with HTTP call.

I have tried accessing HTTP call using "Named Credential" option. 
Created named credential
Name/Label : localhost & http://localhost:8080

Below is my REST API call to access the external REST api,
URL : http:// localhost:8080/spring/home/restRecentActivity

In apex java class, provided below URL to perform HTTP request.

I have verified in logs, getting error message as 400 - BAD REQUEST. Please someone help in providing best samples & to pass the right URI.

Please help me to solve this issue.
Kevin GlinskiKevin Glinski
If you are calling that web service from Apex, that code is running on the salesforce server, so doesn't know what "localhost" is.  You'd have to use a proxy like ngrok to tunnel the traffic into your machine from the public internet.  

For a production solution, your web service would have to be either made public directly, or hosted behind a reverse proxy