|
GeoLocation or Public IP from API - Printable Version +- Ewon Technical Forum (https://techforum.ewon.biz) +-- Forum: Development (https://techforum.ewon.biz/forum-50.html) +--- Forum: Talk2m & Argos API (https://techforum.ewon.biz/forum-54.html) +--- Thread: GeoLocation or Public IP from API (/thread-2131.html) |
GeoLocation or Public IP from API - SRG_IT_Software - 25-10-2022 Greetings, we are trying to find a way to map the position of our machines around the world like it is done on e-catcher. Is it possible via Datamailbox or by interrogating the Ewon directly to find the extimated location or at least the public IP that the device uses to navigate? We already found some information on the forum, but the system requirements dictate that no program is added to the devices, for this specific task. Thanks in advance. RE: GeoLocation or Public IP from API - simon - 27-10-2022 Hi, First, the geolocation is something forseen for a future Talk2M API version (not planned yet). Regarding the below possible option, it only works using Ewon Flexy. I have no solution for Cosy unfortunately. In the Flexy device, you can only get the local connection settings (Wifi SSID, 4G Cell Id, Local Ethernet IP,...) but not the public IP. If you want to get the public IP, you can request the Ewon to get it with one API call and extract it from the device with another API call. The API set to use is the M2Web API. Here is an example using the web service from https://api64.ipify.org. This API call executes a Script command on the device to force it to request its public IP from https://api64.ipify.org : https://m2web.talk2m.com/t2mapi/get/<T2MEwonName>/rcgi.bin/ExeScriptForm?Command=GETHTTP%20%27https://api64.ipify.org%27,%27/usr/ip.txt%27,%20%27/?format=json%27&t2maccount=<T2M_Account>&t2musername=<T2M_User>&t2mpassword=<T2M_Password>&t2mdeveloperid=<T2M_DeveloperID>&t2mdeviceusername=<DeviceUser>&t2mdevicepassword=<DevicePassword> Then you wait some seconds to let the Flexy execute this command and you download the result : https://m2web.talk2m.com/t2mapi/get/<T2MEwonName>/usr/ip.txt?t2maccount=<T2M_Account>&t2musername=<T2M_User>&t2mpassword=<T2M_Password>&t2mdeveloperid=<T2M_DeveloperID>&t2mdeviceusername=<FlexyDeviceUser>&t2mdevicepassword=<FlexyDevicePassword> and you gonna get the content : {"ip":"149.154.234.77"} More info on the M2Web API on https://developer.ewon.biz/content/m2web-api-0 Simon RE: GeoLocation or Public IP from API - SRG_IT_Software - 27-10-2022 Thanks for the assistance, we will try your solution and get back with the results. Fortunately, our machines use almost exclusively the Ewon Flexy, so luck appears to be on our side. Thank you very much. RE: GeoLocation or Public IP from API - SRG_IT_Software - 02-11-2022 Thanks, it worked like a charm. We are very interested in trying this function when it is released in the APIs so, give us a shout. Many thanks for the assistance. RE: GeoLocation or Public IP from API - simon - 02-11-2022 Great to hear that |