Forum Discussion

v-vemami's avatar
v-vemami
Helper
4 years ago

Calling outside api from khoros results in cors issue

Hi Team,

Greetings of the day,

I have created a web API and tried to call from khoros as below

<#assign http_client_request = http.client.request("https", "localhost:44340", "/api/Values").get() />

but I am not able to hit the method in web API and facing the cors issue. And also we need to send one parameter as a input to the API.

Could you please help us to resolve this issue.

 

  • Hi v-vemami , the http.client.request context object is for making server-to-server API calls. You will not be able to test with your localhost using this method. If you do not need a server-side API call, you could try moving your logic to JavaScript/jQuery to call your API. Otherwise, you'll need to host your service in a location that is accessible to Khoros servers.