Forum Discussion
- MohammedFModerator
Hi radhika_kundana!
Glad that you were able to retrieve the IP address using ${http.request.remoteAddr}.
There are multiple approaches such as you could try using FreeMarker with API v2 under
location
andlast_visit_ipaddress
:
https://developer.khoros.com/khoroscommunitydevdocs/docs/gdpr-supportYou could also use our Bulk Data API under
request.geo.city
,request.geo.country
:
https://developer.khoros.com/khoroscommunitydevdocs/reference/bulk-data-api#export-referenceOr, you could go the custom route through services like here.
I hope this helps!
thankyou MohammedF for details.
VarunGrazitti We have below requirements for geo location and its for all users. I would like to check if below functionality is already available.
1. Show(detect) current location in text field as water marker text
2. When user types in location text field, auto suggest places.
We are also planning to develop a component to filter the events or group of selected location.
Any details will be helpful.
Thankyou,
Radhika
radhika_kundana - I don't think these are available OOTB, since the OOTB APIs only give you the IP, however, both could be achieved via some custom snippets and using some 3rd party API to detect the locations based on these IPs.
I hope this helps.
@VarunGrazitti I am able to retireve current user location by calling bing api in ajax.
but when I try to call bing api in endpoint, it gives incorrect user location.
I would like to know if below code is correct to call external api in endpoint:
<#assign response = http.client.request("https://www.bing.com/api/v7/userlocation?appid=xyz1234").get()/>
<#if response.hasError>
${response.error.message}
<#else>
${response.content}
</#if>Hi radhika_kundana,
In order to successfully call the Bing API in FreeMarker, you'll first need to go into Community Admin > System > HTTP Client and add bing.com to the Allowed domain names field.
Hope this helps.
Thankyou jeffshurtliff for your reply.
Yes, I have added www.bing.com to domain field. It wasn't allowing to add just bing.com. Please find attached screenshot.
jeffshurtliff sorry for the confusion, I am still seeing the same issue.
bing api with ajax call gives me correct location where as endpoint gives me in-correct location.
Please suggest me if there is an way to fix this bug.
I was able to make it work by passing ip address in headers.
<#assign response = http.client.request("api").header("X-FORWARDED-FOR",ipaddress).get()/>
Will there be any privacy or security issues in passing IPaddress in headers?
Related Content
- 9 months ago